View generation method and device, electronic equipment and storage medium

By converting and processing the source code data, an extensible markup language file is generated and view layout tools are called, which solves the problem that view generation is not universal and difficult to understand in the prior art, and realizes a more convenient, beautiful and easy to understand view generation.

CN120216616APending Publication Date: 2025-06-27CHINA AUTOMOTIVE INNOVATION CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510183515.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The views generated in the prior art are not universal, it is difficult to obtain software project-level information, and the views generated by complex function structures are incomplete, resulting in misunderstanding.

Method used

By responding to the view generation instructions, reading the source code data, and converting the data to obtain the converted file. Based on the nodes and node content in the conversion file, content conversion and coordinate calculation are performed to obtain the text file object and node coordinates. Then, the data structure and form transformation are performed to obtain the extensible markup language file, and the view layout tool is called to generate the target view.

Benefits of technology

It improves the convenience, aesthetics, versatility and comprehensibility of generating views, and solves the problems of poor convenience, aesthetics, versatility and difficulty in understanding of view generation in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216616A_ABST
    Figure CN120216616A_ABST
Patent Text Reader

Abstract

The invention discloses a view generation method and device, electronic equipment and a storage medium, and the method comprises the steps: reading source code data in response to a view generation instruction; performing data conversion on the source code data to obtain a conversion file; based on nodes and node contents in the conversion file, content conversion and coordinate calculation are carried out, and a text file object and node coordinates of child nodes corresponding to each node are obtained; writing the text file object and the node coordinate of the child node corresponding to each node into a text file to obtain a target text file; based on the target text file, performing data structure and form conversion to obtain an extensible markup language file; and calling a view layout tool, and inputting the extensible markup language file into the view layout tool to generate a target view. By adopting the technical scheme provided by the invention, the convenience of generating the view is improved, and the aesthetic property, the universality and the understandability of the view are further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software projects, and in particular, to a view generation method, device, electronic device, and storage medium. Background Art

[0002] As automotive systems become increasingly complex, software architectures assist development teams in improving the quality and performance of software systems in an intuitive and easy-to-understand manner. Therefore, the demand for architecture restoration visualization is increasing day by day and has become a hot topic of concern.

[0003] Due to the increasing complexity of software projects, development teams need to clarify logic, find errors, enhance memory, and share knowledge in a more convenient and efficient way. As a diagram tool in the Unified Modeling Language (UML) for describing system behavior, UML views can help development teams quickly grasp the logic of each function in software engineering.

[0004] Currently, there are numerous architecture restoration tools emerging in an endless stream. However, the views generated by existing technologies lack universality and are not recognized during the process of project process evaluation in the industry or within the company. In addition, the generated architecture diagrams are not displayed in layers, making it difficult to obtain software project level information. Moreover, for very complex function structures, such as nested loop bodies, it is difficult to obtain the complete code structure from the generated views, which is prone to causing misunderstandings. Therefore, a new view generation method is needed to improve the convenience of view generation, and further enhance the aesthetics, universality, and comprehensibility of the views. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a view generation method, device, electronic device, and storage medium to solve the problems of poor convenience, poor aesthetics, poor universality, and difficulty in understanding in view generation.

[0006] One aspect of the present invention provides a view generation method, which includes the following steps:

[0007] In response to a view generation instruction, read source code data;

[0008] Perform data conversion on the source code data to obtain a conversion file;

[0009] Based on the nodes and node contents in the conversion file, perform content conversion and coordinate calculation to obtain a text file object and the node coordinates of each sub-node corresponding to each node;

[0010] Write the text file object and the node coordinates of each sub-node corresponding to each node into a text file to obtain a target text file;

[0011] Based on the target text file, perform data structure and form conversion to obtain an Extensible Markup Language (XML) file;

[0012] Invoke a view layout tool and input the XML file into the view layout tool to generate a target view.

[0013] Another aspect of the present invention provides a view generation device, which includes:

[0014] An acquisition module, configured to read source code data in response to a view generation instruction;

[0015] A first conversion module, configured to perform data conversion on the source code data to obtain a conversion file;

[0016] A calculation module, configured to perform content conversion and coordinate calculation based on the nodes and node contents in the conversion file to obtain a text file object and the node coordinates of each sub-node corresponding to a node;

[0017] A writing module, configured to write the text file object and the node coordinates of each sub-node corresponding to a node into a text file to obtain a target text file;

[0018] A second conversion module, configured to perform data structure and form conversion based on the target text file to obtain an XML file;

[0019] A generation module, configured to invoke a view layout tool and input the XML file into the view layout tool to generate a target view.

[0020] Another aspect of the present invention provides an electronic device, which includes:

[0021] A processor;

[0022] A memory for storing executable instructions of the processor;

[0023] Wherein, the processor is configured to execute the instructions to implement the view generation method described in any one of the above.

[0024] Another aspect of the present invention provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the view generation method described in any one of the above.

[0025] A view generation method, device, electronic device, and storage medium provided by the present invention read source code data in response to a view generation instruction; then perform data conversion on the source code data to obtain a conversion file, improving the convenience of reading the source code data structure and further enhancing the convenience of generating a target view. Further, based on the nodes and node contents in the conversion file, content conversion and coordinate calculation are performed to obtain a text file object and the node coordinates of each node corresponding to a child node; and the text file object and the node coordinates of each node corresponding to a child node are written into a text file to obtain a target text file. Then, based on the target text file, data structure and form conversion are performed to obtain an Extensible Markup Language (XML) file. Through file conversion, the convenience of generating a target view is improved. Further, a view layout tool is called, and the XML file is input into the view layout tool to generate a target view, improving the aesthetics, generality, and comprehensibility of the generated target view. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following-described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0027] Figure 1 is a flowchart of a view generation method provided according to an exemplary embodiment;

[0028] Figure 2 is a flowchart of performing error checking on source code data to obtain a check result and, when the check result indicates that there is no error in the source code data, performing conversion on the source code data;

[0029] Figure 3 is a flowchart of obtaining a conversion file provided according to an exemplary embodiment;

[0030] Figure 4 is a flowchart of dividing a syntax tree and constructing a conversion file based on division data conditions provided according to an exemplary embodiment;

[0031] Figure 5 is a flowchart of obtaining a text file object and node coordinates provided according to an exemplary embodiment;

[0032] Figure 6 is a flowchart of displaying and editing a target view based on target user requirements provided according to an exemplary embodiment;

[0033] Figure 7 It is a schematic structural diagram of a view generation device provided according to an exemplary embodiment. Detailed implementation manners

[0034] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0035] It should be noted that the terms "first", "second", etc. in the specification and drawings of the present invention are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data used can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0036] Figure 1 It is a schematic flowchart of a view generation method provided according to an exemplary embodiment. This specification provides method operation steps such as in the embodiment or flowchart, but based on routine or non-creative labor, it may include more or fewer operation steps. The order of steps listed in the embodiment is only one way among the execution orders of numerous steps, and does not represent the only execution order. When actually executed in a system or server product, it can be executed in the order shown in the embodiment or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing). Specifically, as Figure 1 shown, an embodiment of a view generation method of the present application is introduced. The above method may include:

[0037] S101: In response to a view generation instruction, read source code data.

[0038] In a specific embodiment, the view generation instruction may be a generation command issued by a target user to a target project when a target view needs to be displayed; optionally, the target project may be a project program for generating a target view; the source code data may be the original data corresponding to the target view;

[0039] Specifically, when the target user needs to display the target view, a view generation instruction is sent to the target project. Correspondingly, in response to the view generation instruction, the target project reads the source code data stored in the system. Further, the source code data is further processed to obtain the target view.

[0040] S103: Perform data conversion on the source code data to obtain a conversion file.

[0041] In a specific embodiment, the conversion file can be a file written with the content after analyzing and converting the source code data. Specifically, after the target project reads the source code data, it performs simple analysis, processing, and conversion on the source code data to obtain the conversion file.

[0042] Figure 2 It is a schematic flowchart of a process for performing error checking on source code data to obtain a check result and performing data conversion on the source code data when the check result indicates that the source code data has no errors according to an exemplary embodiment. In an alternative embodiment, as Figure 2 shown, the above method may further include:

[0043] S201: Perform error checking on the source code data to obtain a check result;

[0044] S203: When the check result indicates that the source code data has no errors, perform data conversion on the source code data to obtain the conversion file.

[0045] In a specific embodiment, the inspection result is used to indicate whether there are errors in the source code data. Optionally, the existence of errors in the source code data may include lexical errors, syntax errors, and semantic errors in the source code data. Specifically, when the target project obtains the source code data, it will perform error checking on the source code data. Optionally, the error checking can be divided into lexical checking, syntax checking, and semantic checking. Specifically, first, lexical checking is performed on the source code data, that is, to check whether there are lexical errors in the source code data. Correspondingly, lexical checking can read the source code data character by character from beginning to end, remove the comments therein, and split the source code data into multiple lexical units (Tokens). When there are lexical errors in the source code data (such as illegal characters and unmatched quotation marks), corresponding errors are reported. Further, in the case where there are no lexical errors in the lexical checking, syntax checking is performed on the source code data, that is, to check whether there are syntax errors in the source code data. Correspondingly, syntax checking can perform corresponding syntax checking on the previously read source code data. When there are syntax errors in the source code data (such as incorrect order inside or between data), corresponding errors are reported. Further, in the case where there are no syntax errors in the syntax checking, semantic checking is performed on the source code data, that is, to check whether there are semantic errors in the source code data. Correspondingly, semantic checking can perform semantic checking on the source code data that has no lexical and syntax errors. Further, when there are semantic errors in the source code data, corresponding errors are reported. Further, in the case where there are no semantic errors in the semantic checking, the source code data is converted, and correspondingly, a conversion file is obtained.

[0046] In the above embodiment, by performing error checking on the source code data and performing data conversion when the inspection result indicates that there are no errors in the source code data, the rigor of data conversion is improved. Further, the rigor of generating the target view is improved.

[0047] Figure 3 It is a schematic flowchart of a process for obtaining a conversion file provided according to an exemplary embodiment. In an optional embodiment, as Figure 3 shown, the above-mentioned data conversion of the source code data to obtain a conversion file may include:

[0048] S301: Perform data conversion on the source code data to obtain a syntax tree;

[0049] S303: Based on the syntax tree, perform data partitioning to obtain the conversion file.

[0050] In a specific embodiment, the syntax tree can be the code data information in the form of a tree structure corresponding to the source code data. Specifically, when there are no errors in the source code data, further analysis is performed on the source code data. Correspondingly, the original data structure information and the original data content information in the source code data can be read. Correspondingly, based on the original data structure information of the read source code data, specifically, the original data structure information can include directory levels, key information in the source code data (such as classes, structures, enums, global variables, function call relationships), etc. Correspondingly, a syntax tree is constructed. Further, the original data content information is correspondingly written into the abstract tree, that is, the syntax tree corresponding to the source code data is formed.

[0051] Further, the structure and content of the source code data can be clearly shown in the syntax tree. Correspondingly, the data in the syntax tree is partitioned, and correspondingly, a conversion file is obtained. Optionally, the target project can preferentially obtain the conversion format. Optionally, the conversion format can be a conversion format defined by the target user or a standard conversion format such as json. Correspondingly, based on the conversion format, the information in the syntax tree is converted to obtain the conversion file.

[0052] In the above embodiment, by partitioning the source code data to obtain a syntax tree, and then converting the syntax tree to obtain a conversion file, the convenience of the source code data structure is improved, and further, the convenience of generating the target view is improved.

[0053] Figure 4 It is a schematic flowchart of a process for partitioning a syntax tree and constructing a conversion file based on partitioning data conditions according to an exemplary embodiment. In an optional embodiment, as Figure 4 shown, the conversion file includes a directory conversion file, a structure conversion file, and a control flow conversion file. The above-mentioned partitioning the data based on the syntax tree to obtain the conversion file may include:

[0054] S401: Obtain the partitioning data conditions;

[0055] S403: Based on the partitioning data conditions, partition the syntax tree to obtain data directory information, data structure information, and data control flow information;

[0056] S405: Based on the data directory information, construct the directory conversion file;

[0057] S407: Based on the data structure information, construct the structure conversion file;

[0058] S409: Based on the data control flow information, construct the control flow conversion file.

[0059] In a specific embodiment, the data partitioning condition may be the partitioning condition of the parse tree. Optionally, the data partitioning condition may include a target information condition, a structure information condition, and a control flow information condition; the data directory information may be the directory information of the data in the parse tree; the data structure information may be the structure information of the data in the parse tree; the data control flow information may be the control flow information of the data in the parse tree; the directory conversion file may be a file containing the data directory and the corresponding directory content of the data directory; the structure conversion file may be a file containing the data structure and the corresponding structure content of the data structure; the control flow conversion file may be a file containing the data control flow and the corresponding control flow content of the data control flow;

[0060] Specifically, the parse tree can be partitioned based on different directory information, or based on the structure information of the parse tree, or based on the control flow information in the parse tree. Correspondingly, based on different data partitioning conditions, the parse tree is partitioned. Further, the data directory information, data structure information, and data control flow information corresponding to the parse tree are obtained. Further, the information in the parse tree is converted to obtain the conversion file;

[0061] Specifically, a directory conversion file is constructed based on the data directory information corresponding to the parse tree. Specifically, based on the directory information content of the data directory information, such as the identifier, relative path, and description information, etc., a directory conversion file is constructed, that is, the target conversion file contains information such as the identifier, relative path, and description information. Specifically, the identifier (id) is the unique identifier generated for the file, used to associate the structure conversion file and the control flow conversion file. The relative path (path) is the relative path of the file, and the description information (description) is the description of the file; that is, the directory conversion file contains information such as the identifier, relative path, and description information;

[0062] Further, a structure conversion file is constructed based on the data structure information corresponding to the parse tree. Specifically, based on the structure information content of the parse tree in the data structure information, such as class information, function information, function call information, and variable information, etc., a structure conversion file is constructed, that is, the structure conversion file contains information such as class information, function information, function call information, and variable information. Specifically, the class information (class) is the information of classes, structures, enumerations, etc. in the current file, stored as an array; the function information (function) is the function information in the current file, stored as an array; the function call information (functionCall) is the information of the functions called in the current file, including the information of the caller and the callee, stored as an array; the variable information (global) is the global variables in the current file, stored as an array; correspondingly, the foregoing structure information is converted into the structure conversion file;

[0063] Further, a control flow conversion file is constructed based on the data control flow information corresponding to the syntax tree. Specifically, based on the control flow information content of the syntax tree in the data control flow information, such as function identifiers, code block names, generated function information, single-line code, number of jumpable codes, previous code block names, and subsequent code block names, etc., a control flow conversion file is constructed. That is, the control flow conversion file contains information such as function identifiers, generated function information, code block names, single-line code, number of jumpable codes, previous code block names, and subsequent code block names. Specifically, the function identifier (function_id) is the unique identifier of the generated function; the generated function information (function_info) is the information of the function, including the function name, parameters, and return type; the single-line code (code_1, code_2); the number of jumpable codes (count) is the number of code blocks that can be jumped to. For example, Succs(2): B1 B2 means that it can jump to B1 or B2; the previous code block name (previous_block_name) is the name of the previous code block and is related to the code block name (block_name); the subsequent code block name (next_block_name) is the name of the subsequent code block and is related to the code block name. Correspondingly, the foregoing control flow information is converted into the control flow conversion file.

[0064] In the above embodiment, the syntax tree is divided by dividing the data conditions, and then based on the obtained information, the corresponding conversion file is constructed, which improves the convenience of constructing the conversion file, makes the content conversion and coordinate calculation of the conversion file clearer and more convenient, and further improves the convenience of generating the target view.

[0065] S105: Based on the nodes and node contents in the conversion file, perform content conversion and coordinate calculation to obtain a text file object and the node coordinates of each sub-node corresponding to each node.

[0066] In a specific embodiment, the node can be each package or each class in the conversion file, the node content can be the package content corresponding to each package or the class content corresponding to each class; the sub-node can be each sub-package of each package or each subclass of each class. Specifically, read the conversion file. Correspondingly, obtain the file content of each conversion file. Further, identify the obtained file content. Correspondingly, obtain the nodes in the conversion file and the node content corresponding to each node. Further, based on the nodes and node contents, perform content conversion and coordinate calculation to obtain a text file object and the node coordinates of each sub-node corresponding to each node.

[0067] Figure 5 It is a schematic flow diagram of obtaining a text file object and node coordinates according to an exemplary embodiment. In an alternative embodiment, such as Figure 5As shown, the above-mentioned content conversion and coordinate calculation based on the nodes and node contents in the conversion file to obtain the text file object and the node coordinates of each sub-node corresponding to each node may include:

[0068] S501: Obtain the target conversion format;

[0069] S503: Based on the target conversion format, the node, and the node content, perform content conversion to obtain the text file object;

[0070] S505: Based on the node and the node content, perform coordinate calculation to obtain the node coordinates of each sub-node corresponding to each node.

[0071] In a specific embodiment, the target conversion format may be a content format supported by the target text file; specifically, based on the target conversion format, call the corresponding conversion function, obtain the node content of each node according to each node in the conversion file, and then perform content conversion. Correspondingly, convert the node content in the conversion file into the text file object in the target text file according to the target conversion format. Optionally, a text object may be constructed based on each node of the conversion file. Correspondingly, fill the content into the text object to obtain the file text object;

[0072] Optionally, while performing content conversion, coordinate calculation is also performed based on the node and the node content. Correspondingly, the node coordinates of each sub-node corresponding to each node are obtained.

[0073] In the above embodiment, by obtaining the target conversion format and converting the node content in the conversion file, the convenience of content conversion is improved, and thus the accuracy of generating the target view is improved. Moreover, coordinate calculation is performed to improve the generality and convenience of generating the target view.

[0074] In an alternative embodiment, the node content includes node relationships and the length of the sub-node content; the above-mentioned coordinate calculation based on the node and the node content to obtain the node coordinates of each sub-node corresponding to each node may include:

[0075] Based on the node, the node relationship, and the length of the sub-node content, perform coordinate calculation to determine the node coordinates of each sub-node corresponding to each node.

[0076] In a specific embodiment, the node relationship can be the association relationship between each node and its corresponding each node and each sub - node. Optionally, the association relationship can be the association relationship between each node and other nodes, or the dependency relationship between each node and its corresponding sub - nodes; the content length of the sub - node can be the size of the content data included in each sub - node; specifically, during the process of coordinate calculation for the target project, corresponding calculation tools will be called. Optionally, the calculation tools can be open - source tools such as graphviz. Correspondingly, when inputting each node, the node content of each node, and the content length of each sub - node corresponding to each node into the calculation tool, the calculation tool will automatically calculate the coordinates. Further, the node coordinates of each sub - node corresponding to each node are obtained.

[0077] In the above - mentioned embodiment, by directly using the calculation tool to calculate the coordinates, the convenience of coordinate calculation is improved. And then using the calculated node coordinates for view layout, the convenience of view layout is improved, thereby improving the aesthetics and comprehensibility of the view.

[0078] S107: Write the text file object and the node coordinates of each sub - node corresponding to each node into a text file to obtain a target text file.

[0079] In an optional embodiment, when obtaining the text file object and the node coordinates of each sub - node corresponding to each node, the target project will correspondingly call a write function, and then write the text file object and the node coordinates of each sub - node corresponding to each node into the file, and correspondingly, obtain a target text file.

[0080] S109: Based on the target text file, perform data structure and form conversion to obtain an Extensible Markup Language file.

[0081] In a specific embodiment, the Extensible Markup Language file can be an xml file; specifically, the target project will obtain the file format corresponding to the Extensible Markup Language file. Correspondingly, based on the file format corresponding to the Extensible Markup Language file, call a conversion function to convert the data structure and data content in the target text file. Correspondingly, perform data structure and data form conversion. Further, obtain an Extensible Markup Language file.

[0082] S111: Call a view layout tool and input the Extensible Markup Language file into the view layout tool to generate a target view.

[0083] In a specific embodiment, the view layout tool may be a layout tool for performing view layout; based on obtaining an Extensible Markup Language (XML) file, the target project calls the view layout tool in the system to perform corresponding view layout. Correspondingly, the XML file is input into the view layout tool, which automatically recognizes the content of the XML file and performs view layout based on the recognized content of the XML file to generate a target view.

[0084] Figure 6 is a schematic flowchart of a process for displaying and editing a target view based on target user requirements provided according to an exemplary embodiment. In an alternative embodiment, as Figure 6 shown, the above method may further include:

[0085] S601: Obtain target user requirements;

[0086] S603: Based on the target user requirements, call the view layout tool to display and edit the target view.

[0087] In a specific embodiment, the target user requirements may be view requirements corresponding to the target user. Optionally, the target user requirements may include requirements such as view display, view update, and view editing (such as modification); specifically, the target user may input their target user requirements into the target project. Correspondingly, based on the target user requirements, the target project calls the view layout tool to display and edit the view. Optionally, after the first generation of the target view, the target project can perform operations such as re-displaying or re-editing the target view based on the target user requirements.

[0088] In the above embodiment, based on the target user requirements, the target view is displayed and edited through the view layout tool, improving the user's guarantee, and further improving the generality and security of the view, and enhancing the user experience.

[0089] A view generation method provided by the present invention reads source code data in response to a view generation instruction, and then performs data conversion on the source code data to obtain a conversion file, which improves the convenience of reading the source code data structure and further improves the convenience of generating a target view. Further, based on the nodes and node contents in the conversion file, content conversion and coordinate calculation are performed to obtain a text file object and the node coordinates of each node corresponding to a child node, and the text file object and the node coordinates of each node corresponding to a child node are written into a text file to obtain a target text file. Further, based on the target text file, data structure and format conversion are performed to obtain an Extensible Markup Language (XML) file. Through file conversion, the convenience of generating a target view is improved. Further, a view layout tool is called, and the XML file is input into the view layout tool to generate a target view, which improves the aesthetics, generality, and comprehensibility of the generated target view.

[0090] Figure 7 FIG. 4 is a schematic structural diagram of a view generation device according to an exemplary embodiment. The following introduces an embodiment of a vehicle positioning device of the present application. Specifically, as Figure 7 shown, the device includes:

[0091] An acquisition module 701, configured to read source code data in response to a view generation instruction;

[0092] A first conversion module 703, configured to perform data conversion on the source code data to obtain a conversion file;

[0093] A calculation module 705, configured to perform content conversion and coordinate calculation based on the nodes and node contents in the conversion file to obtain a text file object and the node coordinates of each node corresponding to a child node;

[0094] A writing module 707, configured to write the text file object and the node coordinates of each node corresponding to a child node into a text file to obtain a target text file;

[0095] A second conversion module 709, configured to perform data structure and format conversion based on the target text file to obtain an Extensible Markup Language (XML) file;

[0096] A generation module 711, configured to call a view layout tool and input the XML file into the view layout tool to generate a target view.

[0097] In an optional embodiment, the above first conversion module 703 includes:

[0098] A syntax tree unit, configured to perform data conversion on the source code data to obtain a syntax tree;

[0099] A partitioning unit, configured to perform data partitioning based on the syntax tree to obtain the conversion file.

[0100] In an optional embodiment, the above-mentioned partitioning unit includes:

[0101] A condition acquisition subunit, configured to acquire partitioning data conditions;

[0102] A specific partitioning subunit, configured to partition the syntax tree based on the partitioning data conditions to obtain data directory information, data structure information, and data control flow information;

[0103] A directory construction subunit, configured to construct the directory conversion file based on the data directory information;

[0104] A structure construction subunit, configured to construct the structure conversion file based on the data structure information;

[0105] A control flow construction subunit, configured to construct the control flow conversion file based on the data control flow information.

[0106] In an optional embodiment, the above-mentioned calculation module 705 includes:

[0107] A conversion acquisition unit, configured to acquire a target conversion format;

[0108] An object acquisition unit, configured to perform content conversion based on the target conversion format, the node, and the node content to obtain the text file object;

[0109] A coordinate calculation unit, configured to perform coordinate calculation based on the node and the node content to obtain the node coordinates of the sub-nodes corresponding to each node.

[0110] In an optional embodiment, the above-mentioned coordinate calculation unit includes a length calculation subunit, configured to:

[0111] Perform coordinate calculation based on the node, the node relationship, and the length of the sub-node content to determine the node coordinates of the sub-nodes corresponding to each node.

[0112] In an optional embodiment, the above-mentioned device further includes:

[0113] An inspection unit, configured to perform error inspection on the source code data to obtain an inspection result;

[0114] An error-free conversion unit, configured to perform data conversion on the source code data to obtain the conversion file when the inspection result indicates that there is no error in the source code data.

[0115] In an optional embodiment, after generating the target view, the above-mentioned device further includes:

[0116] A requirement acquisition unit for acquiring target user requirements;

[0117] An editing unit for displaying and editing the target view by invoking the view layout tool based on the target user requirements.

[0118] In an exemplary embodiment, there is also provided an electronic device, including: a processor; a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the instructions to implement the view generation method as in the embodiments of the present disclosure.

[0119] In an exemplary embodiment, there is also provided a computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the view generation method in the embodiments of the present disclosure.

[0120] In an exemplary embodiment, there is also provided a computer program product or a computer program, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, enabling the computer device to execute the view generation method provided in the above various optional implementation manners.

[0121] It can be understood that in the specific implementation manner of the present invention, it involves user-related data. When the above embodiments of the present invention are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0122] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. This computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided by the present invention can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0123] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present disclosure. The present invention is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include known common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0124] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A view generation method, device, electronic device and storage medium, characterized in that: The method comprises: In response to the view generation instruction, reading source code data; Performing data conversion on the source code data to obtain a conversion file; Based on the nodes and node contents in the conversion file, content conversion and coordinate calculation are performed to obtain the text file object and the node coordinates of the child nodes corresponding to each node; Writing the text file object and the node coordinates of the child nodes corresponding to each node into a text file to obtain a target text file; Based on the target text file, data structure and form conversion is performed to obtain an extensible markup language file; A view layout tool is called, and the extensible markup language file is input into the view layout tool to generate a target view.

2. The method according to claim 1, characterized in that The data conversion of the source code data to obtain the conversion file includes: Performing data conversion on the source code data to obtain a syntax tree; Based on the syntax tree, data division is performed to obtain the conversion file.

3. The method according to claim 2, characterized in that The conversion file includes a directory conversion file, a structure conversion file and a control flow conversion file; the data is divided based on the syntax tree to obtain the conversion file including: Get the conditions for partitioning data; Based on the data division condition, the syntax tree is divided to obtain data directory information, data structure information and data control flow information; Based on the data directory information, construct the directory conversion file; Based on the data structure information, construct the structure conversion file; Based on the data control flow information, the control flow conversion file is constructed.

4. The method according to claim 1, characterized in that: The content conversion and coordinate calculation are performed based on the nodes and node contents in the conversion file to obtain the node coordinates of the text file object and the child nodes corresponding to each node, including: Get the target conversion format; Based on the target conversion format, the node and the node content, content conversion is performed to obtain the text file object; Based on the nodes and the node contents, coordinate calculation is performed to obtain node coordinates of child nodes corresponding to each node.

5. The method according to claim 4, characterized in that The node content includes node relationships and sub-node content lengths; the coordinate calculation based on the nodes and the node content to obtain the node coordinates of the sub-nodes corresponding to each node includes: Based on the nodes, the node relationships and the length of the sub-node contents, coordinate calculation is performed to determine the node coordinates of the sub-nodes corresponding to each node.

6. The method according to claim 1, characterized in that Before converting the source code data to obtain the conversion file, the method further includes: Performing an error check on the source code data to obtain a check result; When the checking result indicates that there is no error in the source code data, data conversion is performed on the source code data to obtain the conversion file.

7. The method according to claim 1, characterized in that After generating the target view, the method further includes: Obtain target user needs; Based on the target user's needs, the view layout tool is called to display and edit the target view.

8. A view generation device, characterized in that: The device comprises: An acquisition module, used for reading source code data in response to a view generation instruction; A first conversion module, used for performing data conversion on the source code data to obtain a conversion file; A calculation module, used to perform content conversion and coordinate calculation based on the nodes and node contents in the conversion file, and obtain the node coordinates of the text file object and the child nodes corresponding to each node; A writing module, used for writing the text file object and the node coordinates of the child nodes corresponding to each node into a text file to obtain a target text file; A second conversion module is used to perform data structure and form conversion based on the target text file to obtain an extensible markup language file; The generating module is used for calling a view layout tool and inputting the extensible markup language file into the view layout tool to generate a target view.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the view generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the view generating method according to any one of claims 1 to 7.