[go: up one dir, main page]

WO2025093052A1 - Low-code conversion method and apparatus, readable storage medium, and device - Google Patents

Low-code conversion method and apparatus, readable storage medium, and device Download PDF

Info

Publication number
WO2025093052A1
WO2025093052A1 PCT/CN2024/135889 CN2024135889W WO2025093052A1 WO 2025093052 A1 WO2025093052 A1 WO 2025093052A1 CN 2024135889 W CN2024135889 W CN 2024135889W WO 2025093052 A1 WO2025093052 A1 WO 2025093052A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
keyword
format
low
component
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/135889
Other languages
French (fr)
Chinese (zh)
Inventor
杨赟鋆
王刚
王远峰
丘凌
陈天明
陶智明
汪洋
张蕤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
E Surfing Digital Life Technology Co Ltd
Original Assignee
E Surfing Digital Life Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by E Surfing Digital Life Technology Co Ltd filed Critical E Surfing Digital Life Technology Co Ltd
Publication of WO2025093052A1 publication Critical patent/WO2025093052A1/en
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of code conversion, and in particular to a low-code conversion method, device, readable storage medium and equipment.
  • the present invention provides a low-code conversion method, device, readable storage medium and equipment, which convert the code snippets of components into data files in a fixed format, and generate code blocks that can be directly used in the IDE system from the data files through scripts, greatly improving the development efficiency of R&D personnel.
  • the present invention provides a low-code snippet conversion method, comprising:
  • the preset second format template is traversed through each of the escaped first format code blocks for matching, and the module name, title and fill code of the component code are extracted from the matched escaped first format code block and filled into the second format template to generate readable code.
  • module name, title and filler code of the component code are extracted according to the first keyword, the second keyword and the third keyword in the complete component code, specifically:
  • a first keyword in the component code is identified, and a text corresponding to the first keyword is set as a module name of a code block;
  • a second keyword is identified between the two adjacent first keywords, and a text corresponding to the second keyword is set as a title of the code block;
  • a third keyword is identified between the adjacent second keywords, and the text between the two adjacent third keywords is set as the filling code of the code block.
  • the first format is Json format.
  • the second format is an integrated development environment format.
  • the present invention further provides a low code fragment conversion device, comprising:
  • Information acquisition module used to obtain complete component code and preset README template
  • a content extraction module for extracting a module name, a title and a filler code of a code block according to the first keyword, the second keyword and the third keyword in the complete component code, and combining the readme file template with the module name, the title and the filler code of the component code to generate a low-code snippet;
  • a format conversion module configured to convert the low-code snippet into a first format code block if an update of the low-code snippet is monitored
  • a parsing and conversion module used for replacing the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively, to obtain a first format code block after the escape;
  • a readable code generation module is used to traverse the preset second format template through each of the escaped first format code blocks for matching, extract the module name, title and filling code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.
  • the content extraction module is used to extract the module name, title and filler code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, including:
  • a coding language determination unit used to determine the proportion of various coding languages in the code library where the component code is stored, and record the coding language with the highest proportion as the code library language;
  • a module name determination unit configured to identify a first keyword in the component code according to a rule of the code library language, and set a text corresponding to the first keyword as a module name of a code block;
  • a title determination unit configured to identify a second keyword between the two adjacent first keywords according to a rule of the code library language, and set a text corresponding to the second keyword as a title of the code block;
  • the filling code determining unit is used to identify a third keyword between the adjacent second keywords according to the rule of the code library language, and set the text between the two adjacent third keywords as the filling code of the code block.
  • the first format is Json format.
  • the second format is an integrated development environment format.
  • the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the low-code conversion methods in the first aspect.
  • the present invention further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it executes any one of the low-code conversion methods in the first aspect.
  • the beneficial effects of adopting the above technical solution are: by converting the low-code snippet format, fillable formatted code blocks are automatically generated according to semantics, reducing the cost of manual writing; and converting the low-code snippets into readable mode, improving the work efficiency of daily development, reducing the workload of importing code into the system, and improving office efficiency.
  • FIG1 is a schematic diagram of a low-code snippet conversion method in one embodiment of the present application.
  • FIG2 is a schematic diagram of a low-code snippet conversion method in one embodiment of the present application.
  • FIG3 is a schematic diagram of Json format code generation in one embodiment of the present application.
  • FIG4 is a schematic diagram of IDE format code generation in one embodiment of the present application.
  • FIG5 is a schematic diagram of searching for code blocks in an IDE system in one embodiment of the present application.
  • FIG6 is a schematic diagram of a partial script of a conversion method in a low-code snippet in one embodiment of the present application.
  • FIG. 7 is a schematic diagram of a conversion device in a low-code fragment in an embodiment of the present application.
  • Git is an open source distributed version control system developed based on the Linux kernel. It uses a distributed version library to make the release and communication of source code extremely convenient, and can handle various project version management effectively and quickly.
  • Git includes workspace, staging area, warehouse area and remote warehouse.
  • the workspace is where developers usually store project component codes; the staging area is used to temporarily store changes to project component codes and save the list of files to be submitted; the warehouse area is also called the version library, which is a safe place to store data and saves all versions of submitted data;
  • the remote warehouse is generally a server that hosts the code and is used for remote data exchange.
  • An integrated development environment system also known as an IDE system, integrates a variety of development tools and functions, can automatically manage code bases, help developers avoid common programming errors, and perform static code analysis and code refactoring to improve code quality.
  • the IDE system also supports multi-person collaborative development, such as multiple developer teams working together to develop projects and complete project components.
  • the present invention provides a low-code conversion method, which converts the complete component code uploaded by the R&D personnel into a low-code fragment that is easy to transmit, and then converts it into a unified first format code so that the code is readable on most platforms, and finally converts it into a second format code so that the component code can be directly applied in the integrated development environment system.
  • the application of this method to a terminal device is used as an example for explanation, combined with the schematic diagram of the low-code conversion method shown in Figure 1 and the schematic diagram of the low-code conversion method flow shown in Figure 2.
  • the embodiment of the present application provides an application scenario of the low-code conversion method, which includes a terminal device provided in the embodiment, wherein the terminal device includes but is not limited to a smart phone and a computer device, wherein the computer device can be at least one of a desktop computer, a portable computer, a laptop computer, a mainframe computer, a tablet computer, etc.
  • the user operates the terminal device to obtain a readable code, and the specific process is shown in the embodiment of the low-code conversion method.
  • Step S101 Obtain complete component code and a preset README file template.
  • the component can also be recorded as an object, which is a simple encapsulation of data and methods.
  • the function of the component can be realized through the complete component code.
  • the complete component code is generally the component code written by the developer.
  • the complete component code is stored in the Git repository. Due to the different development platforms and writing formats used by developers, the complete component code stored in the Git repository exists in multiple coding languages and multiple coding formats.
  • the readme file is used as an auxiliary file provided to the user, which can assist the user in reading and using the component code of the Git repository.
  • the readme file template refers to the description corresponding to each component in the readme file of the Git repository storing the component code.
  • Step S102 extract the module name, title and fill-in code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, and combine the preset self-reading file template with the module name, title and fill-in code of the component code to generate a low-code snippet.
  • the low-code snippet is different from the traditional component complete code, which uses visualization and less code to express the component at a faster speed.
  • the complete component code content is screened, and the unnecessary content is discarded, leaving only the valid code block module name, title and filler code to form a low-code snippet.
  • Step S103 If the low-code snippet is monitored to be updated, convert the low-code snippet into a first format code block.
  • the first format is the Json format, which is a lightweight data exchange format that is easy to read and write, can exchange data between multiple coding languages, is easy to machine parse and generate, and has higher communication and readability.
  • the specific conversion code can be found in Figure 3.
  • Step S104 replace the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively to obtain a first format code block after escape.
  • the first format code block may contain keywords that are likely to cause objections, in order to avoid recognition errors during the conversion of the first format code block, the first keyword, the second keyword and the third keyword in the first format code block are replaced with the first escape character, the second escape character and the third escape character respectively.
  • Step S105 traverse the preset second format template to match each of the escaped first format code blocks, extract the module name, title and fill code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.
  • the second format is the integrated development environment format, and is also a code format that can be recognized in the system environment where the component needs to run.
  • the Git repository stores multiple escaped first format code blocks, and the preset second format template is matched with each escaped first format code block stored in the Git repository to find the escaped first format code block with corresponding information.
  • the corresponding content is filled into the second format template to generate a readable code, and the readable code can be directly called in the integrated development environment.
  • the complete filled code in the readable code can be called by searching for the corresponding keyword.
  • the specific conversion code can be seen in Figure 4.
  • step S102 the code block module name, code block title and code block filling code are extracted according to the first keyword, the second keyword and the third keyword in the complete component code, specifically:
  • Step S201 determining the proportion of various coding languages in the code base where the component code is stored, and recording the coding language with the highest proportion as the code base language.
  • the coding language with the highest proportion is used as the code base language of the Git repository, and a specific coding language label is added.
  • Step S202 According to the rules of the code library language, identify the first keyword in the component code, and set the text corresponding to the first keyword as the module name of the code block.
  • the first keyword may be “###”, the first keyword is identified, and the text corresponding to the first keyword is set as the code block module name.
  • Step S203 According to the rule of the code library language, a second keyword is identified between the two adjacent first keywords, and a text corresponding to the second keyword is set as a code block title.
  • the second keyword is “number+‘.”, which is a list number.
  • the text in the same line as the second keyword is matched as a code block title.
  • Step S204 according to the rule of the code library language, a third keyword is identified between the adjacent second keywords, and the text between the two adjacent third keywords is set as a code block filling code.
  • the third keyword is " ⁇ " or "( ⁇ )"
  • the text between the two third keywords is the filling code.
  • the above-mentioned low-code conversion method first extracts the module name, title and fill-in code of the necessary code block from the complete component code to form a low-code snippet; then converts the low-code snippet into a more general Json format code block, which is more convenient for the code block to perform data conversion in different coding languages; finally, according to the integrated development environment, the Json format code block is converted into an integrated development environment code block, that is, an IDE code block, so that developers can directly search for the module name in the integrated development environment to obtain the complete fill-in code part of the code block; it improves the development efficiency of R&D personnel, and also facilitates the large-scale copying and dissemination of code.
  • the running environment of the low-code conversion method is a bastion host that deploys the Gitlab Runner environment.
  • the bastion host includes but is not limited to computers with Windows, Linux, and MacOS systems.
  • Step S301 The deployment process of the operating environment is as follows:
  • the bastion host maps the project directory to: project directory espod:1.0.0.
  • Step S302 Build the Gitlab Runner module on the bastion host, monitor the changes in commits in the Git repository project, and use the Gitlab Runner script to generate low-code snippets.
  • the specific process is as follows:
  • the low-code snippets of the custom template README file are converted into Json format code blocks, and the Json format code blocks are uploaded to the Git repository.
  • Step S303 Write a script, and after the developer pulls the formatted code repository, generate an IDE code block. See the code content in FIG. 3:
  • Source-Editor-Command file read the IDE code block and display it in the GUI;
  • the above-mentioned low-code conversion method can improve the code writing efficiency of R&D personnel in the daily development process and reduce the workload of searching module codes and importing module codes.
  • the information acquisition module 401 is used to acquire the complete component code and the preset README file template.
  • the content extraction module 402 is used to extract the module name, title and fill-in code of the code block according to the first keyword, the second keyword and the third keyword in the complete component code, and generate a low-code snippet by combining the self-description file template with the module name, title and fill-in code of the component code.
  • the format conversion module 403 is used to convert the low-code snippet into a first format code block if it is monitored that the low-code snippet is updated.
  • the parsing and conversion module 404 is used to replace the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively to obtain a first format code block after escape.
  • the readable code generation module 405 is used to traverse the preset second format template to match each of the escaped first format code blocks, extract the module name, title and filling code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.
  • the coding language determining unit 501 is used to determine the proportion of various coding languages in the code base where the component code is stored, and record the coding language with the highest proportion as the code base language.
  • the title determination unit 503 is used to identify a second keyword between the two adjacent first keywords according to the rule of the code library language, and set the text corresponding to the second keyword as the title of the code block.
  • the filling code determining unit 504 is used to identify a third keyword between the adjacent second keywords according to the rule of the code library language, and set the text between the two adjacent third keywords as the filling code of the code block.
  • Each module in the above device can be implemented in whole or in part by software, hardware and a combination thereof.
  • the above modules can be embedded in or independent of the processor of the terminal device in the form of hardware, or stored in the memory of the terminal device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • the present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned low-code conversion method are implemented.
  • the computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM (erasable programmable read-only memory), a hard disk or a ROM.
  • the computer-readable storage medium includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium has storage space for program codes for executing any method step in the above method. These program codes may be read from or written into one or more computer program products, and the program codes may be compressed in an appropriate form.
  • the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor performs the above-mentioned low-code conversion method when executing the computer program.
  • the computer device includes a memory, a processor, and one or more computer programs, wherein the one or more computer programs can be stored in the memory and configured to be executed by one or more processors, and the one or more applications are configured to execute the above-mentioned low-code conversion method.
  • the processor may include one or more processing cores.
  • the processor uses various interfaces and lines to connect various parts of the entire computer device, and executes various functions of the computer device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory.
  • the processor can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA).
  • DSP digital signal processing
  • FPGA field programmable gate array
  • PDA programmable logic array
  • the processor can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem.
  • the CPU mainly processes the operating system, user interface, and application programs;
  • the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor, but may be implemented separately through a communication chip.
  • the memory may include a random access memory (RAM) or a read-only memory (ROM).
  • the memory may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.
  • the data storage area may also store data created by the terminal device during use, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention provides a low-code conversion method and apparatus, a readable storage medium, and a device. The method comprises: on the basis of a first keyword, a second keyword, and a third keyword in complete component code, extracting a module name, title, and filling code of the component code, and combining a preset readme file template with the module name, title, and filling code of the component code and generating low-code snippets; converting the low-code snippets into first-format code blocks; replacing the first, second, and third keywords with preset first, second, and third escape characters, so as to obtain escaped first-format code blocks; and traversing each escaped first-format code block and performing matching therefor against a preset second-format template, extracting the module name, title, and filling code of the component code from matched escaped first-format code blocks, and filling same into the second-format template and generating readable code. The method achieves automatic generation of fillable formatted code blocks, improving the efficiency of importing code into the system.

Description

低代码转换方法、装置、可读存储介质及设备Low-code conversion method, device, readable storage medium and equipment 技术领域Technical Field

本发明涉及代码转换领域,具体涉及低代码转换方法、装置、可读存储介质及设备。The present invention relates to the field of code conversion, and in particular to a low-code conversion method, device, readable storage medium and equipment.

背景技术Background Art

目前的软件开发流程中,研发人员会将项目工程的源代码保存至Git仓库,然后再将Git仓库交付给代码管理平台运行。然而不同的研发人员采用的开发平台、编码语言以及编码习惯不同,容易出现项目工程的不同组件源代码格式或编码语言不同的情况,因此,研发人员在开发一个组件后,需要手动编写供外部使用的代码片段以及对外的应用程序接口文档,使用者需要花费大量的时间去阅读和理解组件实现的原理。In the current software development process, developers will save the source code of the project to the Git repository, and then deliver the Git repository to the code management platform for operation. However, different developers use different development platforms, coding languages, and coding habits, which may lead to different source code formats or coding languages for different components of the project. Therefore, after developing a component, developers need to manually write code snippets for external use and external application interface documents, and users need to spend a lot of time reading and understanding the principles of component implementation.

若使用者需要使用集成开发环境系统,还需要切换页面将代码复制粘贴至集成开发环境系统中,无法快捷搜索和使用组件库中所有组件。上述状况大大地降低了研发人员的开发效率,也不利于代码大批量复制传播的情况。If the user needs to use the integrated development environment system, they need to switch pages to copy and paste the code into the integrated development environment system, and cannot quickly search and use all components in the component library. The above situation greatly reduces the development efficiency of R&D personnel and is not conducive to the large-scale copying and dissemination of codes.

发明内容Summary of the invention

基于此,本发明提供低代码转换方法、装置、可读存储介质及设备,将组件的代码片段转换为固定格式的数据文件,通过脚本将数据文件生成在IDE系统内可直接使用的代码块,大量提高了研发人员的开发效率。Based on this, the present invention provides a low-code conversion method, device, readable storage medium and equipment, which convert the code snippets of components into data files in a fixed format, and generate code blocks that can be directly used in the IDE system from the data files through scripts, greatly improving the development efficiency of R&D personnel.

第一方面,本发明提供一种低代码片段转换方法,包括:In a first aspect, the present invention provides a low-code snippet conversion method, comprising:

获取完整的组件代码和预设的自述文件模板;Get the complete component code and preset README template;

根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,并将所述预设的自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段;Extracting a module name, a title, and a filler code of the component code according to the first keyword, the second keyword, and the third keyword in the complete component code, and combining the preset readme file template with the module name, the title, and the filler code of the component code to generate a low-code snippet;

若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块;If the low code snippet is updated, convert the low code snippet into a first format code block;

将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块;Replacing the first keyword, the second keyword, and the third keyword with a preset first escape character, a second escape character, and a third escape character, respectively, to obtain a first format code block after the escape;

将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。The preset second format template is traversed through each of the escaped first format code blocks for matching, and the module name, title and fill code of the component code are extracted from the matched escaped first format code block and filled into the second format template to generate readable code.

进一步的,所述根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,具体为:Further, the module name, title and filler code of the component code are extracted according to the first keyword, the second keyword and the third keyword in the complete component code, specifically:

确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言;Determine the proportion of various coding languages in the code base where the component code is stored, and record the coding language with the highest proportion as the code base language;

根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名;According to the rule of the code library language, a first keyword in the component code is identified, and a text corresponding to the first keyword is set as a module name of a code block;

根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块的标题;According to the rule of the code library language, a second keyword is identified between the two adjacent first keywords, and a text corresponding to the second keyword is set as a title of the code block;

根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块的填充代码。According to the rule of the code library language, a third keyword is identified between the adjacent second keywords, and the text between the two adjacent third keywords is set as the filling code of the code block.

进一步的,所述第一格式为Json格式。Furthermore, the first format is Json format.

进一步的,所述第二格式为集成开发环境格式。Furthermore, the second format is an integrated development environment format.

第二方面,本发明还提供一种低代码片段转换装置,包括:In a second aspect, the present invention further provides a low code fragment conversion device, comprising:

信息获取模块,用于获取完整的组件代码和预设的自述文件模板;Information acquisition module, used to obtain complete component code and preset README template;

内容提取模块,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取代码块的模块名、标题和填充代码,并将所述自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段;a content extraction module, for extracting a module name, a title and a filler code of a code block according to the first keyword, the second keyword and the third keyword in the complete component code, and combining the readme file template with the module name, the title and the filler code of the component code to generate a low-code snippet;

格式转换模块,用于若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块;A format conversion module, configured to convert the low-code snippet into a first format code block if an update of the low-code snippet is monitored;

解析转换模块,用于将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块;A parsing and conversion module, used for replacing the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively, to obtain a first format code block after the escape;

可读代码生成模块,用于将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。A readable code generation module is used to traverse the preset second format template through each of the escaped first format code blocks for matching, extract the module name, title and filling code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.

进一步的,所述内容提取模块,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,包括:Furthermore, the content extraction module is used to extract the module name, title and filler code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, including:

编码语言确定单元,用于确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言;A coding language determination unit, used to determine the proportion of various coding languages in the code library where the component code is stored, and record the coding language with the highest proportion as the code library language;

模块名确定单元,用于根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名;A module name determination unit, configured to identify a first keyword in the component code according to a rule of the code library language, and set a text corresponding to the first keyword as a module name of a code block;

标题确定单元,用于根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块的标题;a title determination unit, configured to identify a second keyword between the two adjacent first keywords according to a rule of the code library language, and set a text corresponding to the second keyword as a title of the code block;

填充代码确定单元,用于根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块的填充代码。The filling code determining unit is used to identify a third keyword between the adjacent second keywords according to the rule of the code library language, and set the text between the two adjacent third keywords as the filling code of the code block.

进一步的,所述第一格式为Json格式。Furthermore, the first format is Json format.

进一步的,所述第二格式为集成开发环境格式。Furthermore, the second format is an integrated development environment format.

第三方面,本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现第一方面中任一项低代码转换方法的步骤。In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the low-code conversion methods in the first aspect.

第四方面,本发明还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时,执行第一方面中任一项低代码转换方法。In a fourth aspect, the present invention further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it executes any one of the low-code conversion methods in the first aspect.

采用上述技术方案的有益效果为:通过低代码片段格式转换的方式,根据语义自动生成可填充的格式化代码块,减少人工编写的成本;并且将低代码片段转换为可读模式,提高了日常开发的工作效率,减少了代码导入系统的工作量,提高办公效率。The beneficial effects of adopting the above technical solution are: by converting the low-code snippet format, fillable formatted code blocks are automatically generated according to semantics, reducing the cost of manual writing; and converting the low-code snippets into readable mode, improving the work efficiency of daily development, reducing the workload of importing code into the system, and improving office efficiency.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

图1为本申请一个实施例中低代码片段转换方法示意图;FIG1 is a schematic diagram of a low-code snippet conversion method in one embodiment of the present application;

图2为本申请一个实施例中低代码片段转换方法流程示意图;FIG2 is a schematic diagram of a low-code snippet conversion method in one embodiment of the present application;

图3为本申请一个实施例中Json格式代码生成示意图;FIG3 is a schematic diagram of Json format code generation in one embodiment of the present application;

图4为本申请一个实施例中IDE格式代码生成示意图;FIG4 is a schematic diagram of IDE format code generation in one embodiment of the present application;

图5为本申请一个实施例中IDE系统内搜索代码块示意图;FIG5 is a schematic diagram of searching for code blocks in an IDE system in one embodiment of the present application;

图6为本申请一个实施例中低代码片段中转换方法部分脚本示意图;FIG6 is a schematic diagram of a partial script of a conversion method in a low-code snippet in one embodiment of the present application;

图7为本申请一个实施例中低代码片段中转换装置示意图。FIG. 7 is a schematic diagram of a conversion device in a low-code fragment in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。为了更详细说明本发明,下面结合附图对本发明提供的低代码转换方法、装置、可读存储介质及设备,进行具体的描述。The following will combine the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In order to explain the present invention in more detail, the low-code conversion method, device, readable storage medium and equipment provided by the present invention are specifically described below in combination with the drawings.

Git为基于Linux内核开发的开源的分布式版本控制系统,采用分布式版本库的方式,使源代码的发布和交流极其方便,可有效、高速地处理各种项目版本管理。Git包含工作区、暂存区、仓库区和远程仓库。其中,工作区为开发人员平时存放项目组件代码的地方;暂存区用于临时存放项目组件代码的改动,保存即将提交的文件列表信息;仓库区又称为版本库,是安全存放数据的位置,保存有提交的所有版本的数据;远程仓库一般为托管代码的服务器,用于远程数据交换。Git is an open source distributed version control system developed based on the Linux kernel. It uses a distributed version library to make the release and communication of source code extremely convenient, and can handle various project version management effectively and quickly. Git includes workspace, staging area, warehouse area and remote warehouse. Among them, the workspace is where developers usually store project component codes; the staging area is used to temporarily store changes to project component codes and save the list of files to be submitted; the warehouse area is also called the version library, which is a safe place to store data and saves all versions of submitted data; the remote warehouse is generally a server that hosts the code and is used for remote data exchange.

集成开发环境系统又称IDE系统,集成多种开发工具和功能,能够自动管理代码库,帮助开发人员避免常见的变成错误,还可以执行静态代码分析和代码重构等,提高代码质量。同时IDE系统还支持多人协同开发,例如通过多个开发人员团队协同进行开发项目,完成项目组件等。An integrated development environment system, also known as an IDE system, integrates a variety of development tools and functions, can automatically manage code bases, help developers avoid common programming errors, and perform static code analysis and code refactoring to improve code quality. At the same time, the IDE system also supports multi-person collaborative development, such as multiple developer teams working together to develop projects and complete project components.

目前的软件开发过程中,研发人员需要对一些常用的代码片段采用复制粘贴的方式进行拷贝使用,并且在模块化、组件化应用程度较高的情况下,开发人员使用各个组件时需要阅读对外的应用程序接口文档,使得研发人员的开发效率较低。In the current software development process, R&D personnel need to copy and paste some commonly used code snippets for use. In addition, when the degree of modularization and componentization is high, developers need to read external application program interface documents when using each component, which reduces the development efficiency of R&D personnel.

对此,本发明提供一种低代码转换方法,将研发人员上传的完整的组件代码转换为易于传输的低代码片段,再转换为统一的第一格式代码,使代码在大部分平台上都具有可读性,最后转换为第二格式代码,使组件代码可在集成开发环境系统中直接应用。以该方法应用于终端设备为例进行说明,结合附图1示出的低代码转换方法示意图和附图2示出的低代码转换方法流程示意图。In this regard, the present invention provides a low-code conversion method, which converts the complete component code uploaded by the R&D personnel into a low-code fragment that is easy to transmit, and then converts it into a unified first format code so that the code is readable on most platforms, and finally converts it into a second format code so that the component code can be directly applied in the integrated development environment system. The application of this method to a terminal device is used as an example for explanation, combined with the schematic diagram of the low-code conversion method shown in Figure 1 and the schematic diagram of the low-code conversion method flow shown in Figure 2.

本申请实施例提供了低代码转换方法的应用场景,该应用场景包括实施例提供的终端设备,所述终端设备包括但不限于智能手机和计算机设备,其中计算机设备可以为台式计算机、便携式计算机、膝上型计算机、大型计算机、平板电脑等设备中的至少一种。用户对所述终端设备进行操作,得到可读代码,具体过程请参见低代码转换方法的实施例。The embodiment of the present application provides an application scenario of the low-code conversion method, which includes a terminal device provided in the embodiment, wherein the terminal device includes but is not limited to a smart phone and a computer device, wherein the computer device can be at least one of a desktop computer, a portable computer, a laptop computer, a mainframe computer, a tablet computer, etc. The user operates the terminal device to obtain a readable code, and the specific process is shown in the embodiment of the low-code conversion method.

步骤S101:获取完整的组件代码和预设的自述文件模板。Step S101: Obtain complete component code and a preset README file template.

其中,组件又可记为对象,是对数据和方法的简单封装。通过所述完整的组件代码,可实现所述组件的功能。所述完整的组件代码一般为开发者编写的组件代码。所述完整的组件代码存储于Git仓库中。由于开发者使用的开发平台以及撰写格式不同,Git仓库存储的完整的组件代码存在多种编码语言以及多种编码格式。Among them, the component can also be recorded as an object, which is a simple encapsulation of data and methods. The function of the component can be realized through the complete component code. The complete component code is generally the component code written by the developer. The complete component code is stored in the Git repository. Due to the different development platforms and writing formats used by developers, the complete component code stored in the Git repository exists in multiple coding languages and multiple coding formats.

所述自述文件使用于向使用者提供的辅助文件,可辅助使用者阅读并使用Git仓库的组件代码。所述自述文件模板是指针对存储组件代码的Git仓库的自述文件中每个组件对应的描述。The readme file is used as an auxiliary file provided to the user, which can assist the user in reading and using the component code of the Git repository. The readme file template refers to the description corresponding to each component in the readme file of the Git repository storing the component code.

步骤S102:根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,并将所述预设的自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段。Step S102: extract the module name, title and fill-in code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, and combine the preset self-reading file template with the module name, title and fill-in code of the component code to generate a low-code snippet.

其中,所述低代码片段是指区别于传统的组件完整代码,采用可视化和较少的代码,以较快的速度来表述组件。通过预设的自述文件模板,对完整的组件代码内容进行筛选,将非必要的内容摒弃,只留下有效的代码块模块名、标题和填充代码,构成低代码片段。The low-code snippet is different from the traditional component complete code, which uses visualization and less code to express the component at a faster speed. Through the preset self-reading file template, the complete component code content is screened, and the unnecessary content is discarded, leaving only the valid code block module name, title and filler code to form a low-code snippet.

步骤S103:若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块。Step S103: If the low-code snippet is monitored to be updated, convert the low-code snippet into a first format code block.

其中,第一格式为Json格式,所述Json格式为一种轻量级的数据交换格式,易于阅读和编写,可以在多种编码语言之间进行数据交换,也易于机器解析和生成,具有更高的传播性和可读性。具体转换代码可参见附图3。The first format is the Json format, which is a lightweight data exchange format that is easy to read and write, can exchange data between multiple coding languages, is easy to machine parse and generate, and has higher communication and readability. The specific conversion code can be found in Figure 3.

步骤S104:将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块。Step S104: replace the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively to obtain a first format code block after escape.

由于所述第一格式代码块中可能存在容易引发异议的关键词,为避免对于第一格式代码块进行转换过程中识别错误的情况,将第一格式代码块中的第一关键词、第二关键词和第三关键词分别替换为第一转义符、第二转义符和第三转义符。Since the first format code block may contain keywords that are likely to cause objections, in order to avoid recognition errors during the conversion of the first format code block, the first keyword, the second keyword and the third keyword in the first format code block are replaced with the first escape character, the second escape character and the third escape character respectively.

步骤S105:将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。Step S105: traverse the preset second format template to match each of the escaped first format code blocks, extract the module name, title and fill code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.

其中,所述第二格式为集成开发环境格式,也是组件需要运行的系统环境中可识别的代码格式。所述Git仓库中存储有多个转义后的第一格式代码块,将预设的第二格式模板于Git仓库中存储的各个转义后的第一格式代码块进行匹配,找到存有对应信息的转义后的第一格式代码块。将对应内容填充至第二格式模板生成可读代码,所述可读代码在集成开发环境中可直接被调用,通过搜索对应的关键词即可调用可读代码中完整的填充代码。其中,具体的转换代码可参见附图4。Among them, the second format is the integrated development environment format, and is also a code format that can be recognized in the system environment where the component needs to run. The Git repository stores multiple escaped first format code blocks, and the preset second format template is matched with each escaped first format code block stored in the Git repository to find the escaped first format code block with corresponding information. The corresponding content is filled into the second format template to generate a readable code, and the readable code can be directly called in the integrated development environment. The complete filled code in the readable code can be called by searching for the corresponding keyword. Among them, the specific conversion code can be seen in Figure 4.

进一步的,步骤S102中所述根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取代码块模块名、代码块标题和代码块填充代码,具体为:Furthermore, in step S102, the code block module name, code block title and code block filling code are extracted according to the first keyword, the second keyword and the third keyword in the complete component code, specifically:

步骤S201:确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言。Step S201: determining the proportion of various coding languages in the code base where the component code is stored, and recording the coding language with the highest proportion as the code base language.

根据完整的组件代码所在Git仓库的编码语言占比,以最高占比的编码语言作为Git仓库的代码库语言,并添加具体的编码语言的标签。According to the proportion of coding languages in the Git repository where the complete component code is located, the coding language with the highest proportion is used as the code base language of the Git repository, and a specific coding language label is added.

步骤S202:根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名。Step S202: According to the rules of the code library language, identify the first keyword in the component code, and set the text corresponding to the first keyword as the module name of the code block.

其中,所述第一关键词可为“###”,识别所述第一关键词,并将包含该第一关键词对应的文本设置为代码块模块名。The first keyword may be “###”, the first keyword is identified, and the text corresponding to the first keyword is set as the code block module name.

步骤S203:根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块标题。Step S203: According to the rule of the code library language, a second keyword is identified between the two adjacent first keywords, and a text corresponding to the second keyword is set as a code block title.

例如,所述第二关键词为“数字+‘.’”,为列表序号,通过确定第二关键词,将第二关键词同行的文本匹配为代码块标题。For example, the second keyword is “number+‘.”, which is a list number. By determining the second keyword, the text in the same line as the second keyword is matched as a code block title.

步骤S204:根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块填充代码。Step S204: according to the rule of the code library language, a third keyword is identified between the adjacent second keywords, and the text between the two adjacent third keywords is set as a code block filling code.

其中,所述第三关键词为“`”或“(````)”,在所述两个第三关键词之间的文本为填充代码。Among them, the third keyword is "`" or "(````)", and the text between the two third keywords is the filling code.

通过上述关键词的识别,可得到完整的组件代码中对应的代码块模块名、标题以及填充代码。By identifying the above keywords, the corresponding code block module name, title and filling code in the complete component code can be obtained.

上述低代码转换方法,首先从完整的组件代码中提取必须的代码块的模块名、标题以及填充代码,组成低代码片段;再将所述低代码片段转换为更为通用的Json格式的代码块,更方便代码块进行不同编码语言的数据转换;最后根据集成开发环境,将Json格式的代码块转换为集成开发环境代码块,也就是IDE代码块,使开发人员可在集成开发环境中直接搜索模块名即可得到代码块的完整填充代码部分;提高了研发人员的开发效率,同时也利于代码的大批量复制传播。The above-mentioned low-code conversion method first extracts the module name, title and fill-in code of the necessary code block from the complete component code to form a low-code snippet; then converts the low-code snippet into a more general Json format code block, which is more convenient for the code block to perform data conversion in different coding languages; finally, according to the integrated development environment, the Json format code block is converted into an integrated development environment code block, that is, an IDE code block, so that developers can directly search for the module name in the integrated development environment to obtain the complete fill-in code part of the code block; it improves the development efficiency of R&D personnel, and also facilitates the large-scale copying and dissemination of code.

为了更具体地说明上述地低代码转换方法,结合附图5的代码以及附图6的效果图,给出示例如下:In order to more specifically illustrate the above-mentioned low-code conversion method, an example is given as follows in combination with the code in FIG. 5 and the effect diagram in FIG. 6:

低代码转换方法运行环境为部署Gitlab Runner环境的堡垒机,该堡垒机包括但不限于Windows、Linux、MacOS系统的计算机。The running environment of the low-code conversion method is a bastion host that deploys the Gitlab Runner environment. The bastion host includes but is not limited to computers with Windows, Linux, and MacOS systems.

步骤S301:运行环境的部署过程如下:Step S301: The deployment process of the operating environment is as follows:

搭建Docker运行环境并启动Docker容器;Build the Docker runtime environment and start the Docker container;

在堡垒机终端运行执行命令:docker run-itd-restart=always-privileged=true-name espod-p端口1-p端口2-p端口3-p端口4-v;Run the following command in the bastion machine terminal: docker run-itd-restart=always-privileged=true-name espod -p port1-p port2-p port3-p port4-v;

堡垒机映射工程目录为:工程目录espod:1.0.0。The bastion host maps the project directory to: project directory espod:1.0.0.

步骤S302:在堡垒机搭建Gitlab Runner模块,监听Git仓库项目中commit的变化,利用Gitlab Runner脚本生成低代码片段,具体过程如下:Step S302: Build the Gitlab Runner module on the bastion host, monitor the changes in commits in the Git repository project, and use the Gitlab Runner script to generate low-code snippets. The specific process is as follows:

在堡垒机上安装Gitlab Runner模块,包括以下5种安装方式:Install the Gitlab Runner module on the bastion host, including the following 5 installation methods:

(1)curl-L-output自定义路径/gitlab-runnerhttps://gitlab-runner-downloads,s3.amazonaws,com/latest/binaries/gitlab-runner-linux-amd64;(1) curl -L - output custom path /gitlab-runner https://gitlab-runner-downloads,s3.amazonaws,com/latest/binaries/gitlab-runner-linux-amd64;

(2)chmod+x自定义路径/gitlab-runner;(2) chmod+x custom path/gitlab-runner;

(3)useradd-comment'Coder'-create-home;(3)useradd-comment'Coder'-create-home;

(4)gitlab-runner-shell/bin/bash;(4)gitlab-runner-shell/bin/bash;

(5)gitlab-runner(5)gitlab-runner

install-user=gitlab-runner-working-directory=/home/gitlab-runner;install-user=gitlab-runner-working-directory=/home/gitlab-runner;

启动Gitlab-runner start;Start Gitlab-runner start;

使用gitlab CI设置中的注册URL和注册token信息,注册到堡垒机;Use the registration URL and registration token information in the gitlab CI settings to register to the bastion host;

配置堡垒机Gitlab Runner,注册Git仓库的实时更新监听,具体可在堡垒机终端运行以下命令:gitlab-runner register-url注册URL-registration-token注册token;Configure Gitlab Runner on the bastion machine and register the real-time update monitor of the Git repository. You can run the following command on the bastion machine terminal: gitlab-runner register-url register URL-registration-token register token;

触发监听后将自定义模板自述文件的低代码片段转换为Json格式代码块,并将Json格式代码块上传至Git仓库。After the listener is triggered, the low-code snippets of the custom template README file are converted into Json format code blocks, and the Json format code blocks are uploaded to the Git repository.

步骤S303:编写脚本,待开发人员拉取格式化代码仓库后,生成IDE代码块,可参见附图3的代码内容:Step S303: Write a script, and after the developer pulls the formatted code repository, generate an IDE code block. See the code content in FIG. 3:

解析Json格式代码块,替换代码块中的转义符;Parse the Json format code block and replace the escape characters in the code block;

生成IDE代码块模板template.codesnippet,遍历所有Json格式化代码块,将转义后的代码块填充IDE代码块模板的对应字段;Generate IDE code block template template.codesnippet, traverse all Json formatted code blocks, and fill the corresponding fields of IDE code block template with the escaped code blocks;

获取管理员权限,拷贝生成的IDE代码块至Xcode Code Snippets目录下。Obtain administrator privileges and copy the generated IDE code blocks to the Xcode Code Snippets directory.

通过上述步骤的设置,可在集成开发环境系统中通过搜索功能找到对应的IDE代码块,并直接得到其对应的填充代码。为了进一步提升低代码片段调用过程中的可视化与搜索特性,还可进一步设置:By setting the above steps, you can find the corresponding IDE code block through the search function in the integrated development environment system and directly get its corresponding fill code. In order to further improve the visualization and search features in the low-code snippet calling process, you can also further set:

创建源代码编辑器扩展,在Xcode中创建一个新的macOS项目,将一个新的Xcode Source Editor Extension目标添加到项目中;To create a Source Editor extension, create a new macOS project in Xcode and add a new Xcode Source Editor Extension target to the project.

添加的extension目录下找到info文件,并在XC-Source-Editor-Command-Definitions下添加item;Find the info file in the added extension directory and add item under XC-Source-Editor-Command-Definitions;

在Source-Editor-Command文件中,读取IDE代码块并展示在GUI中;In the Source-Editor-Command file, read the IDE code block and display it in the GUI;

研发运行编辑器扩展后,搜索对应的关键词,双击扩展内代码块自动填充到光标处。After developing and running the editor extension, search for the corresponding keywords and double-click the code block in the extension to automatically fill it at the cursor.

通过上述低代码转换方法,可提高研发人员在日常开发过程中的代码编写效率,减少搜索模块代码、导入模块代码的工作量。The above-mentioned low-code conversion method can improve the code writing efficiency of R&D personnel in the daily development process and reduce the workload of searching module codes and importing module codes.

应该理解的是,虽然附图1-2的流程图中各个步骤按照箭头额定指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以按其他的顺序执行。而且附图1-2中的至少一部分步骤可以包括多个子步骤或者子阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the steps in the flowcharts of Figures 1-2 are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in Figures 1-2 may include multiple sub-steps or sub-stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

上述本发明公开的实施例中详细描述了低代码片段转换方法,对于本发明公开的上述方法可以采用多种形式的设备实现,因此本发明还公开了对应上述方法的低代码片段转换装置,结合附图7,下面给出具体的实施例进行详细说明。The low-code fragment conversion method is described in detail in the embodiment disclosed in the above-mentioned invention. The above-mentioned method disclosed in the present invention can be implemented by various forms of equipment. Therefore, the present invention also discloses a low-code fragment conversion device corresponding to the above-mentioned method. Combined with Figure 7, a specific embodiment is given below for detailed description.

信息获取模块401,用于获取完整的组件代码和预设的自述文件模板。The information acquisition module 401 is used to acquire the complete component code and the preset README file template.

内容提取模块402,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取代码块的模块名、标题和填充代码,并将所述自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段。The content extraction module 402 is used to extract the module name, title and fill-in code of the code block according to the first keyword, the second keyword and the third keyword in the complete component code, and generate a low-code snippet by combining the self-description file template with the module name, title and fill-in code of the component code.

格式转换模块403,用于若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块。The format conversion module 403 is used to convert the low-code snippet into a first format code block if it is monitored that the low-code snippet is updated.

解析转换模块404,用于将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块。The parsing and conversion module 404 is used to replace the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively to obtain a first format code block after escape.

可读代码生成模块405,用于将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。The readable code generation module 405 is used to traverse the preset second format template to match each of the escaped first format code blocks, extract the module name, title and filling code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code.

进一步的,所述内容提取模块402,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,包括:Furthermore, the content extraction module 402 is used to extract the module name, title and filler code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, including:

编码语言确定单元501,用于确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言。The coding language determining unit 501 is used to determine the proportion of various coding languages in the code base where the component code is stored, and record the coding language with the highest proportion as the code base language.

模块名确定单元502,用于根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名。The module name determination unit 502 is used to identify the first keyword in the component code according to the rule of the code library language, and set the text corresponding to the first keyword as the module name of the code block.

标题确定单元503,用于根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块的标题。The title determination unit 503 is used to identify a second keyword between the two adjacent first keywords according to the rule of the code library language, and set the text corresponding to the second keyword as the title of the code block.

填充代码确定单元504,用于根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块的填充代码。The filling code determining unit 504 is used to identify a third keyword between the adjacent second keywords according to the rule of the code library language, and set the text between the two adjacent third keywords as the filling code of the code block.

关于低代码转换装置可全部参见上文对于方法的限定,在此不再赘述。上述装置中的各个模块可全部或者部分通过软件、硬件及其组合来实现。上述各模块可以以硬件形式内嵌于或者独立于终端设备的处理器中,也可以以软件形式存储于终端设备的存储器中,以便处理器调用执行以上各个模块对应的操作。For the low-code conversion device, please refer to the above definition of the method, which will not be repeated here. Each module in the above device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor of the terminal device in the form of hardware, or stored in the memory of the terminal device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

在一个实施例中,本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述低代码转换方法的步骤。In one embodiment, the present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned low-code conversion method are implemented.

所述计算机可读存储介质可以是诸如闪存、EEPROM(电可擦除可编只读程存储器)、EPROM(可擦除可编只读程存储器)、硬盘或者ROM之类的电子存储器。可选的,计算机可读存储介质包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质具有执行上述方法中的任何方法步骤的程序代码的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入这一个或者多个计算机程序产品中,所述程序代码可以以适当形式进行压缩。The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM (erasable programmable read-only memory), a hard disk or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for program codes for executing any method step in the above method. These program codes may be read from or written into one or more computer program products, and the program codes may be compressed in an appropriate form.

在一个实施例中,本发明提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时执行上述低代码转换方法。In one embodiment, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor performs the above-mentioned low-code conversion method when executing the computer program.

所述计算机设备包括存储器、处理器以及一个或多个计算机程序,其中一个或多个计算机程序可以被存储在存储器中并被配置为由一个或多个处理器执行,一个或多个应用程序配置用于执行上述低代码转换方法。The computer device includes a memory, a processor, and one or more computer programs, wherein the one or more computer programs can be stored in the memory and configured to be executed by one or more processors, and the one or more applications are configured to execute the above-mentioned low-code conversion method.

处理器可以包括一个或多个处理核。处理器利用各种接口和线路连接整个计算机设备内的各个部分,通过运行或执行存储在存储器内的指令、程序、代码集或指令集,以及调用存储在存储器内的数据,执行计算机设备的各种功能和处理数据。可选地,处理器可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器可集成中央处理器(Central Processing Unit,CPU)、埋点数据的上报验证器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器中,单独通过一块通信芯片进行实现。The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire computer device, and executes various functions of the computer device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor, but may be implemented separately through a communication chip.

存储器可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器可用于存储指令、程序、代码、代码集或指令集。存储器可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等。存储数据区还可以存储终端设备在使用中所创建的数据等。The memory may include a random access memory (RAM) or a read-only memory (ROM). The memory may be used to store instructions, programs, codes, code sets or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the terminal device during use, etc.

以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

一种低代码片段转换方法,其特征在于,包括:A low code snippet conversion method, characterized by comprising: 获取完整的组件代码和预设的自述文件模板;Get the complete component code and preset README template; 根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,并将所述预设的自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段;Extracting a module name, a title, and a filler code of the component code according to the first keyword, the second keyword, and the third keyword in the complete component code, and combining the preset readme file template with the module name, the title, and the filler code of the component code to generate a low-code snippet; 若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块;If the low code snippet is updated, convert the low code snippet into a first format code block; 将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块;Replacing the first keyword, the second keyword, and the third keyword with a preset first escape character, a second escape character, and a third escape character, respectively, to obtain a first format code block after the escape; 将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。The preset second format template is traversed through each of the escaped first format code blocks for matching, and the module name, title and fill code of the component code are extracted from the matched escaped first format code block and filled into the second format template to generate readable code. 如权利要求1所述的低代码转换方法,其特征在于,所述根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,具体为:The low-code conversion method according to claim 1 is characterized in that the module name, title and filler code of the component code are extracted according to the first keyword, the second keyword and the third keyword in the complete component code, specifically: 确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言;Determine the proportion of various coding languages in the code base where the component code is stored, and record the coding language with the highest proportion as the code base language; 根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名;According to the rule of the code library language, a first keyword in the component code is identified, and a text corresponding to the first keyword is set as a module name of a code block; 根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块的标题;According to the rule of the code library language, a second keyword is identified between the two adjacent first keywords, and a text corresponding to the second keyword is set as a title of the code block; 根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块的填充代码。According to the rule of the code library language, a third keyword is identified between the adjacent second keywords, and the text between the two adjacent third keywords is set as the filling code of the code block. 如权利要求1所述的低代码转换方法,其特征在于,所述第一格式为Json格式。The low-code conversion method as described in claim 1 is characterized in that the first format is Json format. 如权利要求1所述的低代码转换方法,其特征在于,所述第二格式为集成开发环境格式。The low-code conversion method as described in claim 1 is characterized in that the second format is an integrated development environment format. 一种低代码片段转换装置,其特征在于,包括:A low code snippet conversion device, characterized by comprising: 信息获取模块,用于获取完整的组件代码和预设的自述文件模板;Information acquisition module, used to obtain complete component code and preset README template; 内容提取模块,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取代码块的模块名、标题和填充代码,并将所述自述文件模板结合所述组件代码的模块名、标题和填充代码生成低代码片段;a content extraction module, for extracting a module name, a title and a filler code of a code block according to the first keyword, the second keyword and the third keyword in the complete component code, and combining the readme file template with the module name, the title and the filler code of the component code to generate a low-code snippet; 格式转换模块,用于若监听所述低代码片段发生更新,将所述低代码片段转换为第一格式代码块;A format conversion module, configured to convert the low-code snippet into a first format code block if an update of the low-code snippet is monitored; 解析转换模块,用于将所述第一关键词、第二关键词和第三关键词分别替换为预设的第一转义符、第二转义符和第三转义符,得到转义后的第一格式代码块;A parsing and conversion module, used for replacing the first keyword, the second keyword and the third keyword with a preset first escape character, a second escape character and a third escape character respectively, to obtain a first format code block after the escape; 可读代码生成模块,用于将预设的第二格式模板遍历各个所述转义后的第一格式代码块进行匹配,从匹配后的转义后的第一格式代码块提取出组件代码的模块名、标题和填充代码填充至第二格式模板,生成可读代码。A readable code generation module is used to traverse the preset second format template through each of the escaped first format code blocks for matching, extract the module name, title and filling code of the component code from the matched escaped first format code block and fill them into the second format template to generate readable code. 如权利要求5所述的低代码转换模块,其特征在于,所述内容提取模块,用于根据所述完整的组件代码中的第一关键词、第二关键词和第三关键词提取组件代码的模块名、标题和填充代码,包括:The low-code conversion module according to claim 5, characterized in that the content extraction module is used to extract the module name, title and filler code of the component code according to the first keyword, the second keyword and the third keyword in the complete component code, including: 编码语言确定单元,用于确定所述组件代码所存储代码库中各种编码语言的占比,将最高占比的编码语言记为代码库语言;A coding language determination unit, used to determine the proportion of various coding languages in the code library where the component code is stored, and record the coding language with the highest proportion as the code library language; 模块名确定单元,用于根据所述代码库语言的规则,识别所述组件代码中的第一关键词,将所述第一关键词对应的文本设置为代码块的模块名;A module name determination unit, configured to identify a first keyword in the component code according to a rule of the code library language, and set a text corresponding to the first keyword as a module name of a code block; 标题确定单元,用于根据所述代码库语言的规则,从所述相邻的两个第一关键词之间识别第二关键词,将所述第二关键词对应的文本设置为代码块的标题;a title determination unit, configured to identify a second keyword between the two adjacent first keywords according to a rule of the code library language, and set a text corresponding to the second keyword as a title of the code block; 填充代码确定单元,用于根据所述代码库语言的规则,从所述相邻第二关键词之间识别第三关键词,将所述相邻的两个第三关键词之间的文本设置为代码块的填充代码。The filling code determining unit is used to identify a third keyword between the adjacent second keywords according to the rule of the code library language, and set the text between the two adjacent third keywords as the filling code of the code block. 如权利要求5所述的低代码转换装置,其特征在于,所述第一格式为Json格式。The low-code conversion device as described in claim 5 is characterized in that the first format is Json format. 如权利要求5所述的低代码转换装置,其特征在于,所述第二格式为集成开发环境格式。The low-code conversion device as described in claim 5 is characterized in that the second format is an integrated development environment format. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-4中任一项低代码转换方法的步骤。A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of any one of the low-code conversion methods of claims 1-4 are implemented. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时,执行权利要求1-4中任一项低代码转换方法。A computer device comprises a memory and a processor, wherein the memory stores a computer program, and wherein when the processor executes the computer program, it executes any one of the low-code conversion methods of claims 1-4.
PCT/CN2024/135889 2023-10-30 2024-11-29 Low-code conversion method and apparatus, readable storage medium, and device Pending WO2025093052A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311425635.1A CN117453221A (en) 2023-10-30 2023-10-30 Low code conversion method, device, readable storage medium and equipment
CN202311425635.1 2023-10-30

Publications (1)

Publication Number Publication Date
WO2025093052A1 true WO2025093052A1 (en) 2025-05-08

Family

ID=89581303

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/135889 Pending WO2025093052A1 (en) 2023-10-30 2024-11-29 Low-code conversion method and apparatus, readable storage medium, and device

Country Status (2)

Country Link
CN (1) CN117453221A (en)
WO (1) WO2025093052A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453221A (en) * 2023-10-30 2024-01-26 天翼数字生活科技有限公司 Low code conversion method, device, readable storage medium and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190050319A1 (en) * 2017-08-08 2019-02-14 Accenture Global Solutions Limited Intellectual automated security, performance and code generation framework
CN115080406A (en) * 2022-06-24 2022-09-20 平安银行股份有限公司 Code log generation method, device, equipment and storage medium
CN116560642A (en) * 2023-05-11 2023-08-08 中国工商银行股份有限公司 Code generation method and device, electronic equipment and storage medium
CN117453221A (en) * 2023-10-30 2024-01-26 天翼数字生活科技有限公司 Low code conversion method, device, readable storage medium and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190050319A1 (en) * 2017-08-08 2019-02-14 Accenture Global Solutions Limited Intellectual automated security, performance and code generation framework
CN115080406A (en) * 2022-06-24 2022-09-20 平安银行股份有限公司 Code log generation method, device, equipment and storage medium
CN116560642A (en) * 2023-05-11 2023-08-08 中国工商银行股份有限公司 Code generation method and device, electronic equipment and storage medium
CN117453221A (en) * 2023-10-30 2024-01-26 天翼数字生活科技有限公司 Low code conversion method, device, readable storage medium and equipment

Also Published As

Publication number Publication date
CN117453221A (en) 2024-01-26

Similar Documents

Publication Publication Date Title
US10579344B2 (en) Converting visual diagrams into code
US10169034B2 (en) Verification of backward compatibility of software components
CN111736840B (en) Method for compiling applet application, method for running applet application, storage medium and electronic device
US7865870B2 (en) Automatic content completion of valid values for method argument variables
US20160357519A1 (en) Natural Language Engine for Coding and Debugging
US8745581B2 (en) Method and system for selectively copying portions of a document contents in a computing system (smart copy and paste
US11593342B2 (en) Systems and methods for database orientation transformation
JP6479184B2 (en) Computer-executable model reverse engineering method and apparatus
CN110263316A (en) A kind of document handling method, device and computer equipment
CN110688145B (en) Android MVP code automatic generation method and device, medium and electronic equipment
CN111475150B (en) Cross-language binding method, device, equipment and storage medium
WO2025093052A1 (en) Low-code conversion method and apparatus, readable storage medium, and device
CN118445198A (en) A method, device, terminal device and storage medium for determining air space
CN116150527A (en) Component style isolation method, device, equipment, storage medium and product
CN116302087A (en) Application configuration information acquisition method, scaffolding management device, medium and equipment
CN114998038A (en) Abnormal policy processing method and system
CN114691131B (en) Method and device for generating framework code file for user interface UI file
CN114547559A (en) Symbol obfuscation method, apparatus, medium, and computing device
CN114089980A (en) Programming processing method, device, interpreter and nonvolatile storage medium
CN113778434A (en) Multilingual copywriting management method, device, electronic device and storage medium
CN112596737A (en) Method, system, equipment and storage medium for scanning function call relation
CN118363649B (en) APK file fusion method, device, equipment and medium
CN120085910A (en) File processing method, device, equipment and medium
CN118051221A (en) A program generation method and related device
CN121031618A (en) Code text translation method, device and computer program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24885047

Country of ref document: EP

Kind code of ref document: A1