CN116048524A - Page analysis method, device, equipment and storage medium - Google Patents

Page analysis method, device, equipment and storage medium Download PDF

Info

Publication number
CN116048524A
CN116048524A CN202310065997.8A CN202310065997A CN116048524A CN 116048524 A CN116048524 A CN 116048524A CN 202310065997 A CN202310065997 A CN 202310065997A CN 116048524 A CN116048524 A CN 116048524A
Authority
CN
China
Prior art keywords
component
analyzed
page
analysis
tree
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
CN202310065997.8A
Other languages
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.)
China Unionpay Co Ltd
Original Assignee
China Unionpay 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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN202310065997.8A priority Critical patent/CN116048524A/en
Publication of CN116048524A publication Critical patent/CN116048524A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a page analysis method, a device, equipment and a storage medium, and relates to the technical field of computers, wherein the method comprises the following steps: and splitting the page component tree into a component tree skeleton and a component pool. The method comprises the steps of carrying out parallel processing on a plurality of components to be analyzed in a component pool through a component analysis engine to obtain corresponding component codes, then assembling the component codes corresponding to the components to be analyzed to corresponding positions of a component tree skeleton to obtain page codes corresponding to a page component tree, relieving the sequence dependence of upper and lower layer component node analysis in the page component tree, and realizing complete multithread parallel processing among all component nodes, so that the source code generation efficiency is improved. Aiming at the newly-added component, corresponding atomic operations are obtained from an atomic operation library to be combined to generate an analysis atomic operation flow, and the newly-added component is analyzed by adopting the analysis atomic operation flow to obtain corresponding component codes, so that the problem that an iteration platform version needs to be developed when the component is newly-added in the industry is solved.

Description

Page analysis method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a page analysis method, a page analysis device, page analysis equipment and a storage medium.
Background
The low-code technology has gradually become a hot topic in various fields as a new technology that has been raised in recent years. The low-code platform is mainly applied to back-end management and application development of some specific scenes, and is relatively in a starting stage for front-end research personnel.
In the related art, when the low code platform performs page parsing, it generally uses a method of recursively processing each component node downwards from the root node of the component tree of the custom Domain-specific language (Domain-specific language, abbreviated as DSL), where each component node needs to perform parsing processing by corresponding conversion code.
However, the above-mentioned page parsing method is low in efficiency, and when component nodes in a page are increased, problems such as delay and blocking occur in page operation and rendering, so that user experience is affected.
Disclosure of Invention
The embodiment of the application provides a page analysis method, device, equipment and storage medium, which are used for improving page analysis efficiency and avoiding problems of delay, clamping and the like in page operation and rendering.
In one aspect, an embodiment of the present application provides a page parsing method, including:
acquiring a page component tree to be analyzed, and splitting the page component tree into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be analyzed;
the components to be analyzed are processed in parallel through a component analysis engine, and corresponding component codes are obtained;
and assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree.
Optionally, the component pool further includes node information corresponding to each of the plurality of components to be parsed in the page component tree;
the step of assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree, includes:
and based on node information corresponding to each of the plurality of components to be analyzed in the page component tree, mounting the component codes corresponding to each of the plurality of components to be analyzed to corresponding nodes in the component tree skeleton, and obtaining the page codes corresponding to the page component tree.
Optionally, the processing, by the component parsing engine, the plurality of components to be parsed in parallel to obtain corresponding component codes includes:
and processing the components to be analyzed in parallel through a thread pool of the component analysis engine to obtain corresponding component codes.
Optionally, the processing the multiple components to be parsed in parallel to obtain corresponding component codes includes:
aiming at each component to be analyzed, acquiring an analysis atomic operation flow corresponding to the component to be analyzed from an analysis flow cache;
and analyzing the component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed.
Optionally, the parsing atomic operation flow includes a plurality of atomic operations;
analyzing the component to be analyzed based on the analysis atomic operation flow to obtain a component code of the component to be analyzed, including:
and sequentially executing the atomic operations on the component to be analyzed according to the sequence of the atomic operations in the atomic operation flow of analysis to obtain the component code of the component to be analyzed.
Optionally, before the parallel processing is performed on the components to be resolved by the component resolving engine to obtain the corresponding component codes, the method further includes:
if the analysis flow cache does not contain the analysis atomic operation flow corresponding to the component to be analyzed, loading flow configuration information corresponding to the component to be analyzed;
based on the flow configuration information, acquiring a plurality of atomic operations corresponding to the component to be analyzed from an atomic operation library;
and assembling the plurality of atomic operations to obtain an analysis atomic operation flow corresponding to the component to be analyzed, and storing the analysis atomic operation flow in the analysis flow cache.
Optionally, each atom operation corresponding to the component to be parsed is used for: and converting a basic attribute or a basic function of the component to be parsed into an abstract syntax tree segment.
Optionally, the method further comprises:
and constructing a new atomic operation corresponding to the new basic attribute or the new basic function, and adding the new atomic operation into the atomic operation library.
In one aspect, an embodiment of the present application provides a page parsing apparatus, including:
the splitting module is used for acquiring a page component tree to be analyzed and splitting the page component tree into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be analyzed;
the analysis module is used for carrying out parallel processing on the components to be analyzed through the component analysis engine to obtain corresponding component codes;
and the assembly module is used for assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree.
Optionally, the component pool further includes node information corresponding to each of the plurality of components to be parsed in the page component tree;
the assembly module is specifically used for:
and based on node information corresponding to each of the plurality of components to be analyzed in the page component tree, mounting the component codes corresponding to each of the plurality of components to be analyzed to corresponding nodes in the component tree skeleton, and obtaining the page codes corresponding to the page component tree.
Optionally, the parsing module is specifically configured to:
and processing the components to be analyzed in parallel through a thread pool of the component analysis engine to obtain corresponding component codes.
Optionally, the parsing module is specifically configured to:
aiming at each component to be analyzed, acquiring an analysis atomic operation flow corresponding to the component to be analyzed from an analysis flow cache;
and analyzing the component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed.
Optionally, the parsing atomic operation flow includes a plurality of atomic operations;
the analysis module is specifically used for:
and sequentially executing the atomic operations on the component to be analyzed according to the sequence of the atomic operations in the atomic operation flow of analysis to obtain the component code of the component to be analyzed.
Optionally, the parsing module is further configured to:
the method comprises the steps that a component analysis engine is used for carrying out parallel processing on a plurality of components to be analyzed, and before corresponding component codes are obtained, if the analysis atomic operation flow corresponding to the components to be analyzed is not contained in the analysis flow cache, flow configuration information corresponding to the components to be analyzed is loaded;
based on the flow configuration information, acquiring a plurality of atomic operations corresponding to the component to be analyzed from an atomic operation library;
and assembling the plurality of atomic operations to obtain an analysis atomic operation flow corresponding to the component to be analyzed, and storing the analysis atomic operation flow in the analysis flow cache.
Optionally, each atom operation corresponding to the component to be parsed is used for: and converting a basic attribute or a basic function of the component to be parsed into an abstract syntax tree segment.
Optionally, the parsing module is further configured to:
and constructing a new atomic operation corresponding to the new basic attribute or the new basic function, and adding the new atomic operation into the atomic operation library.
In one aspect, embodiments of the present application provide a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the page parsing method described above when the processor executes the program.
In one aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the above-described page parsing method.
In the embodiment of the application, the page component tree is split into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be resolved. And then, carrying out parallel processing on a plurality of components to be analyzed through a component analysis engine to obtain corresponding component codes, and then assembling the component codes corresponding to the components to be analyzed into corresponding positions in a component tree skeleton to obtain page codes corresponding to a page component tree, so that the sequential dependence of the analysis of upper and lower layer component nodes in the page component tree is relieved, the complete multithreading parallel processing among all component nodes is realized, the source code generation efficiency is improved, and the problems of delay, blocking and the like in page operation and rendering are avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it will be apparent that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic structural diagram of a system architecture according to an embodiment of the present application;
fig. 2 is a flow chart of a page parsing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a structure of a page component tree according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a component tree skeleton according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a component pool according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of an atomic operation according to an embodiment of the present disclosure;
FIG. 7 is a schematic flow chart of an atomic extraction operation according to an embodiment of the present disclosure;
fig. 8 is a flow chart of a component parsing method according to an embodiment of the present application;
fig. 9 is a flow chart of a component code mounting method according to an embodiment of the present application;
fig. 10 is a flow chart of a page parsing method according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a page parsing device according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantageous effects of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
For ease of understanding, the terms involved in the embodiments of the present invention are explained below.
An abstract Syntax tree (Abstract Syntax Tree, AST), or simply Syntax tree (syncax tree), is an abstract representation of the source code Syntax structure. It represents the syntax structure of a programming language in the form of a tree, each node on the tree representing a structure in the source code.
Domain-specific language, DSL, refers to a computer language that is focused on a particular application Domain, and translated into a Domain specific language. Unlike the common cross-domain general-purpose computer language, domain-specific languages are used only in certain specific domains.
Referring to fig. 1, a system architecture diagram applicable to the embodiments of the present application includes at least a terminal device 101 and a low code platform 102, where the number of terminal devices 101 may be one or more, and the number of low code platforms 102 may be one or more, and the number of terminal devices 101 and low code platforms 102 is not specifically limited in this application.
An application program is pre-installed in the terminal device 101, wherein the application program is a client application, a web page application, an applet application, or the like. The terminal device 101 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart home appliance, a smart voice interaction device, a smart car-mounted device, and the like.
The terminal equipment 101 submits the page component tree to the low code platform 102 through the application program, and the low code platform 102 analyzes the page component tree to obtain a corresponding page code. The low-code platform 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligence platform. The terminal device 101 and the low code platform 102 may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
Based on the system architecture diagram shown in fig. 1, the embodiment of the present application provides a flow of a page parsing method, as shown in fig. 2, where the flow of the method is performed by a computer device, and the computer device may be the low code platform 102 shown in fig. 1, and includes the following steps:
step S201, obtaining a page component tree to be analyzed, and splitting the page component tree into a component tree skeleton and a component pool.
Specifically, the page component tree includes multiple types of components to be resolved, which may be front-end page components. For example, referring to fig. 3, a schematic structural diagram of a page component tree according to an embodiment of the present application is provided, a root node of the page component tree is component 0, and child nodes of the component 0 include: component 1, component 2 and component 3, the child node of component 1 is component 1.1, the child node of component 3 includes: assembly 3.1 and assembly 3.2, the child node of assembly 3.1 comprising: assembly 3.1.1, assembly 3.1.2 and assembly 3.1.3.
Inputting the page component tree into a page analysis engine for processing, splitting the page component tree into a component tree skeleton and a component pool by the page analysis engine, wherein the component pool comprises a plurality of components to be analyzed and node information corresponding to the components to be analyzed in the page component tree, and the component tree skeleton comprises: and the plurality of components to be analyzed respectively correspond to the node information in the page component tree.
For example, the page component tree shown in fig. 3 is split to obtain a component tree skeleton and a component pool, wherein the structure of the component tree skeleton is shown in fig. 4, and the structure of the component pool is shown in fig. 5.
As can be seen from fig. 4, the component tree skeleton includes node information corresponding to each of the plurality of components in fig. 1 in the page component tree. Specifically, component 0 corresponds to node 1, component 1 corresponds to node 2, component 2 corresponds to node 4, component 3 corresponds to node 5, component 1.1 corresponds to node 3, component 3.1 corresponds to node 6, component 3.2 corresponds to node 10, component 3.1.1 corresponds to node 7, component 3.1.2 corresponds to node 8, and component 3.1.3 corresponds to node 9.
As can be seen from fig. 5, the component pool includes a plurality of items, and each item includes 1 component in fig. 1 and node information corresponding to the component in the page component tree. Specifically, item 1 includes component 0 and node 1, item 2 includes component 1 and node 2, item 3 includes component 2 and node 4, item 4 includes component 3 and node 5, item 5 includes component 1.1 and node 3, item 6 includes component 3.1 and node 6, item 7 includes component 3.2 and node 10, item 8 includes component 3.1.1 and node 7, item 9 includes component 3.1.2 and node 8, and item 10 includes component 3.1.3 and node 9.
Step S202, a plurality of components to be analyzed are processed in parallel through a component analysis engine, and corresponding component codes are obtained.
Specifically, the component parsing engine includes a thread pool that includes a plurality of threads. And processing the components to be analyzed in parallel through a thread pool of the component analysis engine to obtain corresponding component codes, so that component node parallel analysis without sequential dependence is realized.
In some embodiments, for each component to be resolved, a resolved atomic operation flow corresponding to the component to be resolved is obtained from a resolved flow cache. And then analyzing the component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed.
Specifically, the analysis atomic operation flow includes a plurality of atomic operations, and according to the sequence of the plurality of atomic operations in the analysis atomic operation flow, the plurality of atomic operations are sequentially executed on the component to be analyzed, so as to obtain the component code of the component to be analyzed.
In the embodiment of the application, the component to be analyzed is automatically analyzed through the analysis atomic operation flow, the corresponding component code is generated, and the generation efficiency of the source code is improved.
In some embodiments, the component parsing engine processes the multiple components to be parsed in parallel, and before obtaining the corresponding component codes, if the parsing flow cache does not include the parsing atomic operation flow corresponding to the components to be parsed, loading flow configuration information corresponding to the components to be parsed. And then based on the flow configuration information, acquiring a plurality of atomic operations corresponding to the component to be analyzed from an atomic operation library, assembling the plurality of atomic operations to obtain an analysis atomic operation flow corresponding to the component to be analyzed, and storing the analysis atomic operation flow in an analysis flow cache.
Specifically, atomic operations that abstract into different abstract syntax trees by classifying the underlying properties and underlying functions of the components.
In practical applications, the basic attributes include some simple static attribute parameters commonly used by the components, mainly including numerical types, boolean types representing parameter switches, character string types of display contents, and combination types of Object objects and arrays. The basic functions comprise some dynamic function type parameters used by the components and responding to external interaction, and mainly comprise some computing expressions, function types, event handles, component state interaction and other types.
For example, the structure of the atomic operation is shown in fig. 6, and the main functions are: the basic attributes or basic functions of the component are converted into corresponding abstract syntax tree fragments.
The process of extracting atomic operations for different basic attributes and basic functions is shown in fig. 7, where basic attributes and basic functions are extracted from components, and atomic operations are extracted according to types of basic attributes and basic functions, where the types of basic attributes include: numerical type, boolean type, string type, object, and array type. Atomic operations for the value types for converting the value types of the components into corresponding values AST; atomic operations for boolean types for converting the boolean types of components into corresponding boolean AST; an atomic operation for the character string type, which is used for converting the character string type of the component into a corresponding character string AST; an atomic operation for an Object for converting the Object of the component into a corresponding Object AST; an atomic operation for an array type is used to convert the array type of the component into a corresponding array AST.
Types of basic functions include: expression, function type, event handler, and component state. Atomic operations on the expressions for converting the expressions of the component into corresponding expressions AST; atomic operations for the function types, for converting the function types of the components into corresponding functions AST; an atomic operation for an event handler for converting the event handler of the component into a corresponding event AST; atomic operations for component states are used to transform the component states of the component into corresponding states AST.
And aiming at the newly-added component to be analyzed, taking out corresponding atomic operations from the atomic operation library according to the flow configuration information of the newly-added component to be analyzed through the component analysis engine, and sequentially assembling the corresponding atomic operations into an analysis atomic operation flow. And analyzing the newly added component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed. Each atomic operation corresponding to the component to be parsed is used for: a basic attribute or a basic function of the component to be parsed is converted into an abstract syntax tree segment.
For example, as shown in fig. 8, a component a is input into a component parsing engine, the component parsing engine determines whether the parsing flow cache includes a parsing atomic operation flow corresponding to the component a, if so, the parsing atomic operation flow corresponding to the component a is obtained from the parsing flow cache, and then the component a is parsed by using the parsing atomic operation flow, so as to obtain a component code of the component a.
Otherwise, acquiring flow configuration information corresponding to the component A, then taking out corresponding atomic operations (specifically, atomic operation 1, atomic operation 4, atomic operation 7 and atomic operation 8) from an atomic operation library according to the flow configuration information, assembling the taken-out atomic operations in sequence to generate an analysis atomic operation flow corresponding to the component A, and then adding the analysis atomic operation flow corresponding to the component A into an analysis flow cache. The component analysis engine acquires an analysis atomic operation flow corresponding to the component A from the analysis flow cache, and then analyzes the component A by adopting the analysis atomic operation flow to acquire a component code of the component A.
In the embodiment of the application, basic attributes and basic functions of the components are classified and abstracted into atomic operations of different abstract syntax tree segments, and dynamic configuration of the atomic operations is supported, so that when a new component appears, the atomic operations can be combined to obtain an analysis atomic operation flow of the new component, the problem that a low-code platform in the industry must be used for developing an iteration platform version when the component is newly added is solved, and the flexibility and efficiency of the new component are improved.
In some embodiments, an add-on atomic operation corresponding to the add-on basic attribute or the add-on basic function is constructed, and the add-on atomic operation is added to the atomic operation library.
Specifically, when the newly added basic attribute or the newly added basic function appears and the newly added basic attribute or the newly added basic function does not correspond to the atomic operation, the corresponding atomic operation is newly added and added into the atomic operation library to perfect the atomic operation library, so that when the newly added component appears, the low-code platform can acquire the corresponding atomic operation from the atomic operation library by adopting the basic function of the material tool and combine the basic function so as to obtain the analysis atomic operation flow of the newly added component, solve the problem that the newly added component in the industry needs the efficiency of the issuing of the low-code platform, and further improve the flexibility and the efficiency of the newly added component.
Step S203, assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton, and obtaining the page codes corresponding to the page component tree.
Specifically, after the page component tree is split into a component tree skeleton and a component pool, the component pool comprises a plurality of components to be analyzed and node information corresponding to the components to be analyzed in the page component tree, and the component tree skeleton comprises: and the plurality of components to be analyzed respectively correspond to the node information in the page component tree.
Based on node information corresponding to each of the plurality of components to be analyzed in the page component tree, mounting the component codes corresponding to each of the plurality of components to be analyzed to corresponding nodes in the component tree skeleton, and obtaining page codes corresponding to the page component tree.
In practical application, the grammar analysis and code generation of the components do not adopt the traditional sequential execution of hierarchical branches from top to bottom, but all components to be analyzed of the page component tree are firstly extracted and put into a thread pool for parallel processing, so that the corresponding component codes are obtained. And then re-mounting the obtained component codes on the corresponding component tree frameworks according to the node position information attached when the component codes are extracted, and the components of the child nodes do not need to wait for the completion of the component processing of the father node, thereby realizing parallel grammar analysis and code generation of component no-order dependence.
For example, as shown in fig. 9, the component tree skeleton includes nodes 1 to 9 therein. After the component code corresponding to the component 3 is obtained, since the component 3 corresponds to the node 5 in the component tree skeleton, the component code of the component 3 is mounted to the node 5 in the component tree skeleton, and it is not necessary to wait for the processing of the component 0 corresponding to the node 1 (the node 1 is the parent node of the node 5) to be completed.
After the component code corresponding to the component 1.1 is obtained, since the component 1.1 corresponds to the node 3 in the component tree skeleton, the component code of the component 1.1 is mounted to the node 3 in the component tree skeleton, and it is not necessary to wait for the processing of the component 1 corresponding to the node 2 (the node 2 is the parent node of the node 3) to be completed.
After the component code corresponding to the component 3.1.1 is obtained, since the component 3.1.1 corresponds to the node 7 in the component tree skeleton, the component code of the component 3.1.1 is mounted to the node 7 in the component tree skeleton, and the component 3.1 corresponding to the node 6 (the node 6 is a parent node of the node 7) does not need to be processed and completed first.
After the component code corresponding to the component 3.1.2 is obtained, since the component 3.1.2 corresponds to the node 8 in the component tree skeleton, the component code of the component 3.1.2 is mounted to the node 8 in the component tree skeleton, and the component 3.1 corresponding to the node 6 (the node 6 is the parent node of the node 7) does not need to be processed and completed first.
In the embodiment of the application, the page component tree is split into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be resolved. And then, carrying out parallel processing on a plurality of components to be analyzed through a component analysis engine to obtain corresponding component codes, and then assembling the component codes corresponding to the components to be analyzed into corresponding positions in a component tree skeleton to obtain page codes corresponding to a page component tree, so that the sequential dependence of the analysis of upper and lower layer component nodes in the page component tree is relieved, the complete multithreading parallel processing among all component nodes is realized, the source code generation efficiency is improved, and the problems of delay, blocking and the like in page operation and rendering are avoided.
For better explaining the embodiments of the present application, a method for parsing a page provided in the embodiments of the present application is described below in connection with a specific implementation scenario, where the flow of the method may be executed by a page parsing engine in the low code platform 102 shown in fig. 1, as shown in fig. 10, and includes the following steps:
inputting a page component tree into a page parsing engine, splitting the page component tree into a component tree skeleton and a component pool by the page parsing engine, wherein the component pool comprises a project 1 to a project 9, the project 1 comprises a component 0 and a node 1, the project 2 comprises a component 1 and a node 2, the project 3 comprises a component 2 and a node 4, the project 4 comprises a component 3 and a node 5, the project 5 comprises a component 1.1 and a node 3, the project 6 comprises a component 3.1 and a node 6, the project 7 comprises a component 3.2 and a node 10, the project 8 comprises a component 3.1.1 and a node 7, the project 9 comprises a component 3.1.2 and a node 8, and the project 10 comprises a component 3.1.3 and a node 9. The component tree skeleton comprises nodes 1 to 9.
The page analysis engine inputs the component pool into the component analysis engine, and for each component in the component pool, the component analysis engine judges whether the analysis flow cache contains the analysis atomic operation flow corresponding to the component, if so, the analysis atomic operation flow corresponding to the component is obtained from the analysis flow cache, and then the component is analyzed by adopting the analysis atomic operation flow, so that the component code of the component is obtained.
Otherwise, acquiring flow configuration information corresponding to the component, then taking out corresponding atomic operations from an atomic operation library according to the flow configuration information, assembling the taken-out atomic operations in sequence to obtain an analysis atomic operation flow corresponding to the component, and then adding the analysis atomic operation flow corresponding to the component into an analysis flow cache. And then acquiring an analysis atomic operation flow corresponding to the component from the analysis flow cache, and analyzing the component by adopting the analysis atomic operation flow to acquire a component code of the component.
And the page analysis engine mounts the component codes of each component to corresponding nodes in the component tree skeleton and outputs page codes corresponding to the page component tree.
In the embodiment of the application, basic attributes and basic functions of the components are classified, the basic attributes and the basic functions are abstracted into atomic operations of different abstract syntax trees, and dynamic configuration of the atomic operations is supported. Secondly, aiming at the newly-added component, corresponding atomic operations are obtained from an atomic operation library through basic functions of a material tool on the low-code platform to be combined, an analysis atomic operation flow of the newly-added component is generated, and the newly-added component is analyzed by adopting the analysis atomic operation flow to obtain corresponding component codes, so that the problem that other low-code platforms in the industry must do development of iteration platform versions when the component is newly-added is solved. In addition, the grammar analysis and code generation of the components are not performed in the traditional sequence of level-by-level branches from top to bottom, but all components to be analyzed of the page component tree are firstly extracted and put into a thread pool of a component analysis engine to be processed in parallel, so that corresponding component codes are obtained; and then re-mounting the component codes on the corresponding component tree frameworks according to the node position information attached when the component codes are extracted, and the components of the child nodes do not need to wait for the components of the father nodes to be analyzed first to obtain the component codes, so that the code generation speed of the components and the analysis speed of the whole page components are improved.
Based on the same technical concept, the embodiment of the present application provides a schematic structural diagram of a page parsing apparatus, as shown in fig. 11, the page parsing apparatus 1100 includes:
the splitting module 1101 is configured to obtain a page component tree to be parsed, and split the page component tree into a component tree skeleton and a component pool, where the component pool includes a plurality of components to be parsed;
the parsing module 1102 is configured to perform parallel processing on the multiple components to be parsed through a component parsing engine, so as to obtain corresponding component codes;
and an assembling module 1103, configured to assemble the component codes corresponding to the components to be parsed to corresponding positions in the component tree skeleton, so as to obtain the page codes corresponding to the page component tree.
Optionally, the component pool further includes node information corresponding to each of the plurality of components to be parsed in the page component tree;
the assembly module 1103 is specifically configured to:
and based on node information corresponding to each of the plurality of components to be analyzed in the page component tree, mounting the component codes corresponding to each of the plurality of components to be analyzed to corresponding nodes in the component tree skeleton, and obtaining the page codes corresponding to the page component tree.
Optionally, the parsing module 1102 is specifically configured to:
and processing the components to be analyzed in parallel through a thread pool of the component analysis engine to obtain corresponding component codes.
Optionally, the parsing module 1102 is specifically configured to:
aiming at each component to be analyzed, acquiring an analysis atomic operation flow corresponding to the component to be analyzed from an analysis flow cache;
and analyzing the component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed.
Optionally, the parsing atomic operation flow includes a plurality of atomic operations;
the parsing module 1102 is specifically configured to:
and sequentially executing the atomic operations on the component to be analyzed according to the sequence of the atomic operations in the atomic operation flow of analysis to obtain the component code of the component to be analyzed.
Optionally, the parsing module 1102 is further configured to:
the method comprises the steps that a component analysis engine is used for carrying out parallel processing on a plurality of components to be analyzed, and before corresponding component codes are obtained, if the analysis atomic operation flow corresponding to the components to be analyzed is not contained in the analysis flow cache, flow configuration information corresponding to the components to be analyzed is loaded;
based on the flow configuration information, acquiring a plurality of atomic operations corresponding to the component to be analyzed from an atomic operation library;
and assembling the plurality of atomic operations to obtain an analysis atomic operation flow corresponding to the component to be analyzed, and storing the analysis atomic operation flow in the analysis flow cache.
Optionally, each atom operation corresponding to the component to be parsed is used for: and converting a basic attribute or a basic function of the component to be parsed into an abstract syntax tree segment.
Optionally, the parsing module 1102 is further configured to:
and constructing a new atomic operation corresponding to the new basic attribute or the new basic function, and adding the new atomic operation into the atomic operation library.
In the embodiment of the application, basic attributes and basic functions of the components are classified, the basic attributes and the basic functions are abstracted into atomic operations of different abstract syntax trees, and dynamic configuration of the atomic operations is supported. Secondly, aiming at the newly-added component, corresponding atomic operations are obtained from an atomic operation library through basic functions of a material tool on the low-code platform to be combined, an analysis atomic operation flow of the newly-added component is generated, and the newly-added component is analyzed by adopting the analysis atomic operation flow to obtain corresponding component codes, so that the problem that other low-code platforms in the industry must do development of iteration platform versions when the component is newly-added is solved. In addition, the grammar analysis and code generation of the components are not performed in the traditional sequence of level-by-level branches from top to bottom, but all components to be analyzed of the page component tree are firstly extracted and put into a thread pool of a component analysis engine to be processed in parallel, so that corresponding component codes are obtained; and then re-mounting the component codes on the corresponding component tree frameworks according to the node position information attached when the component codes are extracted, and the components of the child nodes do not need to wait for the components of the father nodes to be analyzed first to obtain the component codes, so that the code generation speed of the components and the analysis speed of the whole page components are improved.
Based on the same technical concept, the embodiment of the present application provides a computer device, which may be a low-code platform shown in fig. 1, and as shown in fig. 12, includes at least one processor 1201 and a memory 1202 connected to the at least one processor, where a specific connection medium between the processor 1201 and the memory 1202 is not limited in the embodiment of the present application, and a bus connection between the processor 1201 and the memory 1202 is exemplified in fig. 12. The buses may be divided into address buses, data buses, control buses, etc.
In the embodiment of the present application, the memory 1202 stores instructions executable by the at least one processor 1201, and the at least one processor 1201 can perform the steps of the page parsing method described above by executing the instructions stored in the memory 1202.
Where the processor 1201 is a control center of a computer device, various interfaces and lines may be used to connect various parts of the computer device to implement page resolution by executing or executing instructions stored in the memory 1202 and invoking data stored in the memory 1202. Alternatively, the processor 1201 may include one or more processing units, and the processor 1201 may integrate an application processor that primarily processes operating systems, user interfaces, application programs, and the like, with a modem processor that primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 1201. In some embodiments, processor 1201 and memory 1202 may be implemented on the same chip, or they may be implemented separately on separate chips in some embodiments.
The processor 1201 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, and may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
Memory 1202 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 1202 may include at least one type of storage medium, which may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory), magnetic Memory, magnetic disk, optical disk, and the like. Memory 1202 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer device, but is not limited to such. The memory 1202 in the present embodiment may also be circuitry or any other device capable of implementing a memory function for storing program instructions and/or data.
Based on the same inventive concept, the embodiments of the present application provide a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the above-described page parsing method.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, or as a computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer device or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer device or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer device or other programmable apparatus to produce a computer device implemented process such that the instructions which execute on the computer device or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (11)

1. A method for page resolution, comprising:
acquiring a page component tree to be analyzed, and splitting the page component tree into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be analyzed;
the components to be analyzed are processed in parallel through a component analysis engine, and corresponding component codes are obtained;
and assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree.
2. The method of claim 1, wherein the component pool further comprises node information corresponding to each of the plurality of components to be parsed in the page component tree;
the step of assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree, includes:
and based on node information corresponding to each of the plurality of components to be analyzed in the page component tree, mounting the component codes corresponding to each of the plurality of components to be analyzed to corresponding nodes in the component tree skeleton, and obtaining the page codes corresponding to the page component tree.
3. The method of claim 1, wherein the parallel processing, by the component parsing engine, of the plurality of components to be parsed to obtain corresponding component codes comprises:
and processing the components to be analyzed in parallel through a thread pool of the component analysis engine to obtain corresponding component codes.
4. The method of claim 3, wherein the parallel processing of the plurality of components to be parsed to obtain corresponding component codes includes:
aiming at each component to be analyzed, acquiring an analysis atomic operation flow corresponding to the component to be analyzed from an analysis flow cache;
and analyzing the component to be analyzed based on the analysis atomic operation flow to obtain the component code of the component to be analyzed.
5. The method of claim 4, wherein the parse atomic operation procedure comprises a plurality of atomic operations;
analyzing the component to be analyzed based on the analysis atomic operation flow to obtain a component code of the component to be analyzed, including:
and sequentially executing the atomic operations on the component to be analyzed according to the sequence of the atomic operations in the atomic operation flow of analysis to obtain the component code of the component to be analyzed.
6. The method of claim 4, wherein the parallel processing, by the component parsing engine, of the plurality of components to be parsed to obtain corresponding component codes further comprises:
if the analysis flow cache does not contain the analysis atomic operation flow corresponding to the component to be analyzed, loading flow configuration information corresponding to the component to be analyzed;
based on the flow configuration information, acquiring a plurality of atomic operations corresponding to the component to be analyzed from an atomic operation library;
and assembling the plurality of atomic operations to obtain an analysis atomic operation flow corresponding to the component to be analyzed, and storing the analysis atomic operation flow in the analysis flow cache.
7. The method of claim 6, wherein each atom operation corresponding to the component to be parsed is to: and converting a basic attribute or a basic function of the component to be parsed into an abstract syntax tree segment.
8. The method as recited in claim 6, further comprising:
and constructing a new atomic operation corresponding to the new basic attribute or the new basic function, and adding the new atomic operation into the atomic operation library.
9. A page parsing apparatus, comprising:
the splitting module is used for acquiring a page component tree to be analyzed and splitting the page component tree into a component tree skeleton and a component pool, wherein the component pool comprises a plurality of components to be analyzed;
the analysis module is used for carrying out parallel processing on the components to be analyzed through the component analysis engine to obtain corresponding component codes;
and the assembly module is used for assembling the component codes corresponding to the components to be analyzed to the corresponding positions in the component tree skeleton to obtain the page codes corresponding to the page component tree.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1-8 when the program is executed.
11. A computer readable storage medium, characterized in that it stores a computer program executable by a computer device, which program, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1-8.
CN202310065997.8A 2023-01-12 2023-01-12 Page analysis method, device, equipment and storage medium Pending CN116048524A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310065997.8A CN116048524A (en) 2023-01-12 2023-01-12 Page analysis method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310065997.8A CN116048524A (en) 2023-01-12 2023-01-12 Page analysis method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116048524A true CN116048524A (en) 2023-05-02

Family

ID=86113114

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310065997.8A Pending CN116048524A (en) 2023-01-12 2023-01-12 Page analysis method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116048524A (en)

Similar Documents

Publication Publication Date Title
US11157560B2 (en) System and method for managing graph data
US8745584B2 (en) Dependency injection by static code generation
US10042740B2 (en) Techniques to identify idiomatic code in a code base
CN107506181A (en) Business processing, data processing method, device and electronic equipment
CN111414350A (en) Service generation method and device
CN110941655B (en) Data format conversion method and device
CN105824974A (en) Method and system for analyzing and processing data
CN116028028B (en) Request function generation method, device, equipment and storage medium
CN112988163A (en) Intelligent programming language adaptation method and device, electronic equipment and medium
CN116661789A (en) Page structure conversion method, device, computer equipment and readable storage medium
CN115390852A (en) Method and device for generating uniform abstract syntax tree and program analysis
CN115599386A (en) Code generation method, device, equipment and storage medium
CN111782211A (en) Parameter page dynamic generation method and device based on Vue component
CN110874350A (en) Method and device for processing structured log data
CN113342399B (en) Method and device for configuring structure of application program and readable storage medium
CN116048524A (en) Page analysis method, device, equipment and storage medium
CN104408198A (en) Method and device for acquiring webpage contents
CN114371886A (en) Front-end frame assembly conversion method and device, computer equipment and storage medium
CN111752967A (en) SQL-based data processing method and device, electronic equipment and storage medium
Powers JavaScript Cookbook: Programming the Web
CN114089960B (en) Object processing method and device
US12079179B2 (en) Systems, methods, and media for accessing derivative properties from a post relational database utilizing a logical schema instruction that includes a base object identifier
CN111190917B (en) Data processing method and device
CN108459914B (en) Middleware command execution method and device
CN117473957A (en) Device and method capable of supporting multi-language text analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination