CN112748925A - Method, device and equipment for analyzing front-end code by using label - Google Patents

Method, device and equipment for analyzing front-end code by using label Download PDF

Info

Publication number
CN112748925A
CN112748925A CN201911047210.5A CN201911047210A CN112748925A CN 112748925 A CN112748925 A CN 112748925A CN 201911047210 A CN201911047210 A CN 201911047210A CN 112748925 A CN112748925 A CN 112748925A
Authority
CN
China
Prior art keywords
code
code segment
label
segment
tag
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
CN201911047210.5A
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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201911047210.5A priority Critical patent/CN112748925A/en
Publication of CN112748925A publication Critical patent/CN112748925A/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

Abstract

The application relates to a method, a device and equipment for resolving a front-end code by using a label, wherein the method comprises the following steps: acquiring a label in an object code, wherein the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code; splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code; and analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface. According to the method and the device, the nested front-end codes are analyzed by using the rear-end tags, the problem that the front-end codes mixed in the rear-end codes cannot be analyzed is solved, and the analyzed codes can be rendered by the browser.

Description

Method, device and equipment for analyzing front-end code by using label
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, and a device for parsing a front-end code using a tag.
Background
In the programming in computing, there are multiple programming languages, according to the division of responsibility, it can be divided into two aspects of front end and back end, the front end finishes the interface and presents the relevant work content, may include every aspect such as theme, overall arrangement, style, presentation form, etc., the work of the back end is generally to provide the interface and provide the data for the front end, usually in the course of framework development, usually use the front end and back end to separate and develop, such advantage is favorable to different coders to carry on the decoupling before, do not need to care about that the front end or back end is written with that language. In a newly developed system framework, complete separation of front and back ends is considered in the design process, but in the implementation process of the framework, partial functions cannot be completely separated from the front and back ends, for example, a background management plug-in a system plug-in of the framework, the background management plug-in relates to generation of a left menu and replacement of codes containing non-back-end languages, such as js and vue codes, and the like.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present application provides a method, an apparatus, and a device for parsing a front-end code using a tag, where the nested front-end code is parsed using a back-end tag, so that the parsed code fragments can be rendered by a browser.
In a first aspect, the present application provides a method for parsing a front-end code by using a tag, including:
acquiring a label in an object code, wherein the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code;
splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code;
and analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
Further, the step of obtaining the tag in the object code comprises:
and acquiring a code tag and a data tag in the object code, wherein the code tag comprises a code start tag and a code end tag, and the data tag comprises a data start tag and a data end tag.
Further, the splitting the object code by using the label in the object code to obtain a code segment set includes:
and taking a first type code segment and a second type code segment as the first code segment in the code segment set, wherein codes of the first type code segment are positioned between a code start label and a code end label of the same code label, and codes in the second type code segment are continuous and are not positioned between the code start label and the code end label of the same code label.
Further, the step of parsing the first code segment in the set to obtain a second code segment includes:
in the case where the first code segment is the first type of code segment, directly taking the first code segment as the second code segment;
and under the condition that the first code segment is the second code segment, splitting and data filling are carried out on the first code segment to obtain the second code segment.
Further, the obtaining the second code segment by splitting and data stuffing the first code segment comprises:
taking a code between a data start label and a data end label of the same data label in the first code segment as a code segment to be processed, and replacing a parameter in the code segment to be processed with a parameter value corresponding to the parameter to obtain a second code segment;
and taking a target sub-code segment in the first code segment as the second code segment, wherein codes in the target sub-code segment are continuous and are not positioned between a data start label and a data end label of the same data label.
Further, replacing the parameter in the code segment to be processed with the parameter value corresponding to the parameter to obtain the second code segment includes:
acquiring parameter values corresponding to parameters in the code segment to be processed;
and under the condition that the number of the parameter values is multiple, replacing the multiple parameter values into the code segment to be processed to obtain multiple second code segments, wherein the obtained number of the second code segments is the same as the number of the parameter values, and any two obtained parameter values of the parameters in the second code segments are different.
Further, in the case that there are a plurality of parameter values, replacing the plurality of parameter values into the code segment to be processed to obtain a plurality of second code segments includes:
carrying out serialization processing on the data containing the plurality of parameter values to obtain a parameter value sequence containing the plurality of parameter values;
and respectively replacing each parameter value in the parameter value sequence into the code segment to be processed to obtain a plurality of second code segments.
In a second aspect, the present application provides an apparatus for parsing a front-end code using a tag, including:
the system comprises a label acquisition module, a label analysis module and a label analysis module, wherein the label acquisition module is used for acquiring a label in an object code, the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code;
the code splitting module is used for splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code;
and the code analysis module is used for analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
In another aspect, the present application provides an apparatus comprising: at least one processor, and at least one memory, bus connected with the processor;
the processor and the memory complete mutual communication through the bus;
the processor is configured to call program instructions in the memory to perform the method for parsing a front-end code using tags described above.
In another aspect, the present application provides a storage medium having a program stored thereon, where the program is loaded into and executed by a processor to implement the method for parsing front-end code using tags as described above.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
according to the method and the device for analyzing the front-end code by using the label, the nested front-end code is analyzed by using the back-end label, so that the problem that the front-end code mixed in the back-end code cannot be analyzed is solved, and the analyzed code can be rendered by a browser.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a method for resolving a front-end code by using a tag according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an object code provided in an embodiment of the present application;
fig. 3 is a schematic diagram illustrating a result of data source serialization according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a result obtained by analyzing a target code according to an embodiment of the present application;
fig. 5 is a schematic diagram of an apparatus for parsing a front-end code by using a tag according to an embodiment of the present application;
fig. 6 is a schematic view of an internal structure of an apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic flowchart of a method for resolving a front-end code by using a tag according to an embodiment of the present application, where as shown in fig. 1, the method includes:
s11, obtaining a label in an object code, wherein the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code.
Specifically, taking fig. 2 as an example, a predefined tag set is obtained first, and the defined tags include a code tag and a data tag. The defined label can be determined according to the content of the code to be processed, or the writing rule of the code can be preset, the content of the label is defined in the rule, and then the code is written according to the preset writing rule when the code is written. The code label and the data label are respectively divided into a start label and an end label, and the content between the start label and the end label is the scope of the label. The code labels defined in fig. 2 are: <% >, data label is: < { } >, the first two are the start tag and the end tag of the code tag, respectively, and the second two are the start tag and the end tag of the data tag, respectively.
S12, splitting the object code by using the label in the object code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the object code.
Specifically, a parsing code with a nested front-end code in the back-end and a data source corresponding to the current code are obtained. And performing json datamation and serialization on the data source, converting the json format of the key value pair, and directly calling parameter values in the serialized data to replace the parameters in the code when the analyzed code is subsequently operated.
The processing of the data source can be placed at the beginning of the parsing process or at the end of the parsing process. It can be known from the code of fig. 2 that the Name of the data source is Persons, and now it is assumed that there are two pieces of data in Persons, and each object in Persons contains two attributes, i.e., an Id attribute and a Name attribute. Now json data and sequence are performed on Persons, and a code as shown in fig. 3 is obtained, wherein data of one Person is Id 1, Name three, Id 2 and Name lie four.
And splitting the code to be analyzed according to the code label obtained in the embodiment to obtain a data set containing the code segment. For example, after the code in fig. 2 is split by using the code tag, the obtained data set is a:
1.<el-aside class="page-nav"style="height:100%;width:auto;">
<el-menu class="adminsitemenu-el-menu-vertical">
2.<%
3.for(var index in Model.Persons){var item=Model.Persons[index]
4.%>
5.<el-submenu index="<{item.Id}>">
<el-menu-item><{item.Name}></el-menu-item>
</el-submenu>
6.<%
7.}
8.%>
9.</el-menu></el-aside>
since section 2 is a code start tag, section 4 is a code end tag, the code before section 2 can be split into sections, section 3 between a code start tag and a code end tag can be split into sections, section 5 between a code end tag to the next code start tag can be split into sections, and so can sections 6 to 9.
S13, analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
Specifically, splitting a code by using a code tag, starting to analyze the code, traversing each code segment in the split code segment set a, judging each code segment in the traversal, assuming that the name of a default initial state value is Flag ═ false, and if the value of the current item is equal to the code start tag <%, skipping the loop at the same time; and if the current value is equal to the code end label% >, skipping the loop by Flag ═ false at the same time, wherein skipping the loop can be understood as stopping analyzing the current code segment, then analyzing the next code segment, and deleting the corresponding label after the analysis is finished.
That is, when it is detected that the value of the head code of the current code section is equal to the defined code start tag <%, the value of Flag is changed to true, and the values of the head codes of the codes between the code start tag <% and the code end tag% > are both true, until it is detected that the value of the head code of the current code section is equal to the defined code end tag% >, the value of Flag is changed back to false, and the values of the head codes of the codes between the code end tag% > and the next code start tag <% are both false. Judging the value of the current code Flag when the current value is neither the code start tag nor the code end tag, if the current value is true, directly performing code logic splicing on the current item, otherwise, if the value of the current code Flag is true, transmitting the current code segment as a parameter to a data tag analysis function to perform data tag analysis; logical splicing may be understood as splicing the current code section after the last parsed code section.
For example, when the set a is parsed, according to the rule described in the above embodiment, the process executed is: firstly, taking the 1 st code segment in the set A, wherein the 1 st code segment is not equal to a code start label and not equal to a code end label, and because the label start state value of a default code label analyzing function is false, the program transmits the value of the 1 st code segment as a parameter to a data label analyzing function in the data label analyzing function; the 2 nd code segment is a code start tag, the value of Flag is changed into true, the code segment is skipped to be analyzed, and the code tag is deleted; the 3 rd code segment is not equal to the code start tag and not equal to the code end tag, because the value of Flag is changed into true when the 2 nd code segment is analyzed, the default value of the 3 rd code segment is also true, the 3 rd code segment is directly spliced and spliced to the 1 st code segment; the 4 th code segment is a code end tag, changes the value of Flag back to false, and deletes the code end tag at the same time; the 5 th code segment is not equal to the code start tag and not equal to the code end tag, because the value of Flag is changed to false when the 4 th code segment is parsed, the default value of the 5 th code segment is also false, and the 5 th code segment is transferred to the data tag function for parsing according to the above rule; the 6 th-9 th code segment is the same as the parsing process described above, and the parsing process of the 6 th-9 th code segment can be understood by those skilled in the art according to the parsing process described above.
In the data label analysis function, the logic of work is the same as that of the code label function, firstly, the transmitted data is split according to the data label to obtain a split set, each item in the set is traversed, if the current item is equal to the starting label < { of the data label, the initial state value in the data label analysis function is marked as true, the current cycle is skipped, if the current value is equal to the data label ending label } > the initial state value is marked as false, the current cycle is skipped at the same time, if only the current value is neither the data starting label nor the data ending label, the initial state value is judged, if the current value is true, the current item is directly spliced and returned, otherwise, the current is returned after being subjected to space removal, line changing and other processing. And when traversing according to the split set of the code label is completed, the label analysis is completed, and finally, an execution function is called, and the code which can be executed by the front end is finally returned.
Still taking the code of fig. 2 as an example, in the code set a after the code tag parsing, the 1 st code segment, the 5 th code segment and the 9 th code segment are transferred to the data tag parsing function, according to the above rule, the 1 st code segment and the 9 th code segment are not equal to the code start tag nor the code end tag, because the tag start state value of the function of parsing the code tag is false by default, the 1 st code segment and the 9 th code segment are returned to the original positions after being subjected to space removal, line feed and other processing (the code segment is not embodied); and because the 5 th code segment contains the data tag, the 5 th code segment can be further split into the following sub-code segments by using the data tag according to the above rules:
5a.<el-submenu index="
5b.<{
5c.item.Id
5d.}>
5e."><el-menu-item>
5f.<{
5g.item.Name
5h.}>
5i.</el-menu-item></el-submenu>
the code is analyzed, the code segment 5a is not equal to the data start tag and not equal to the data end tag, and because the tag initial state value of the function for analyzing the data tag is false by default, the code segment 5a is returned to the original position after being subjected to processing such as blank space removal, line feed and the like (the code segment is not embodied); the code segment 5b is a data start tag, changes the value of Flag to true, skips over the parsing code segment 5b, and deletes the data start tag; the code segment 5c is not equal to the data start tag nor the data end tag, because the value of Flag is changed to true when the code segment 5b is analyzed, the default value of the code segment 5c is also true, and the code segment 5c is directly subjected to logic splicing and spliced to the code segment 5 a; the code segment 5d is a data end tag, changes the value of Flag back to false, and deletes the data end tag at the same time; the parsing of the code segments 5e-5i is the same as the parsing of the code segments 5a-5d described above, and the parsed code segments can be identified and executed by the front-end.
Finally, calling an execution function at the back end, and writing the code segment obtained by analysis and the parameter value subjected to json serialization into the execution function to obtain the following execution code:
var Model { "Persons": [ { "Id":1, "Name": Zhang three "}, {" Id ":2," Name ": Li four" } the
var html=”
html+="<el-aside class="page-nav"style="height:100%;width:auto;">
<el-menu class="adminsitemenu-el-menu-vertical">";
for(var index in Model.Persons){var item=Model.Persons[index]
html+="<el-submenu index=";
html+=item.Id;
html+="><el-menu-item>;
html+=item.Name;
html+="</el-menu-item></el-submenu>";
}
html+="</el-menu></el-aside>";
html;
The execution code generated above is executed at the back end, and the result as shown in fig. 4 is finally obtained, and the code in fig. 4 can be executed by the front end for being displayed on the front end interface.
The method solves the problem that when the code fragments of the front-end language are nested in the back end, the nested front-end logic is analyzed in the back end, and the code fragments related to the nested front-end logic are analyzed into the front-end codes which can be executed by the browser.
As shown in fig. 5, a schematic diagram of an apparatus for parsing a front-end code by using a tag according to an embodiment of the present application is provided, where the apparatus includes:
a tag obtaining module 51, configured to obtain a tag in an object code, where the object code is a code to be analyzed and used to provide a service for a front-end interface, and the tag in the object code is a symbol used to distinguish a code segment in the object code;
a code splitting module 52, configured to split the target code by using a tag in the target code to obtain a code segment set, where the code segment set includes a plurality of first code segments obtained by splitting the target code;
and a code analysis module 53, configured to analyze the first code segment in the set to obtain a second code segment, where an operation result of the second code segment is used for displaying on the front-end interface.
The device for analyzing the front-end code by using the label comprises a processor and a memory, wherein the label acquisition module, the code splitting module, the code analyzing module and the like are stored in the memory as program modules, and the processor executes the program modules stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the kernel parameters are adjusted to ensure that the included front-end codes are analyzed at the back end.
An embodiment of the present invention provides a storage medium having a program stored thereon, where the program, when executed by a processor, implements the method for parsing a front-end code using a tag.
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for analyzing a front-end code by using a label is executed when the program runs.
As shown in fig. 6, an embodiment of the present invention provides a device 70, where the device 70 includes at least one processor 701, at least one memory 702 connected to the processor, and a bus 703; the processor 701 and the memory 702 complete mutual communication through a bus 703; the processor 701 is configured to call program instructions in the memory 702 to perform the above-described method of parsing the front-end code using tags. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: a method for resolving front-end code using tags, comprising:
acquiring a label in an object code, wherein the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code;
splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code;
and analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
Further, the step of obtaining the tag in the object code comprises:
and acquiring a code tag and a data tag in the object code, wherein the code tag comprises a code start tag and a code end tag, and the data tag comprises a data start tag and a data end tag.
Further, the splitting the object code by using the label in the object code to obtain a code segment set includes:
and taking a first type code segment and a second type code segment as the first code segment in the code segment set, wherein codes of the first type code segment are positioned between a code start label and a code end label of the same code label, and codes in the second type code segment are continuous and are not positioned between the code start label and the code end label of the same code label.
Further, the step of parsing the first code segment in the set to obtain a second code segment includes:
in the case where the first code segment is the first type of code segment, directly taking the first code segment as the second code segment;
and under the condition that the first code segment is the second code segment, splitting and data filling are carried out on the first code segment to obtain the second code segment.
Further, the obtaining the second code segment by splitting and data stuffing the first code segment comprises:
taking a code between a data start label and a data end label of the same data label in the first code segment as a code segment to be processed, and replacing a parameter in the code segment to be processed with a parameter value corresponding to the parameter to obtain a second code segment;
and taking a target sub-code segment in the first code segment as the second code segment, wherein codes in the target sub-code segment are continuous and are not positioned between a data start label and a data end label of the same data label.
Further, replacing the parameter in the code segment to be processed with the parameter value corresponding to the parameter to obtain the second code segment includes:
acquiring parameter values corresponding to parameters in the code segment to be processed;
and under the condition that the number of the parameter values is multiple, replacing the multiple parameter values into the code segment to be processed to obtain multiple second code segments, wherein the obtained number of the second code segments is the same as the number of the parameter values, and any two obtained parameter values of the parameters in the second code segments are obtained.
Further, in the case that there are a plurality of parameter values, replacing the plurality of parameter values into the code segment to be processed to obtain a plurality of second code segments includes:
carrying out serialization processing on the data source containing the plurality of parameter values to obtain a code sequence containing the parameters and the corresponding parameter values;
and respectively replacing each parameter value in the code sequence into the code segment to be processed to obtain a plurality of second code segments.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for parsing a front-end code using a tag, comprising:
acquiring a label in an object code, wherein the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code;
splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code;
and analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
2. The method of claim 1, wherein the step of obtaining the tag in the object code comprises:
and acquiring a code tag and a data tag in the object code, wherein the code tag comprises a code start tag and a code end tag, and the data tag comprises a data start tag and a data end tag.
3. The method of claim 2, wherein the splitting the object code with the tag in the object code to obtain a set of code segments comprises:
and taking a first type code segment and a second type code segment as the first code segment in the code segment set, wherein codes of the first type code segment are positioned between a code start label and a code end label of the same code label, and codes in the second type code segment are continuous and are not positioned between the code start label and the code end label of the same code label.
4. The method of claim 3, wherein parsing the first code segment of the set to obtain a second code segment comprises:
in the case where the first code segment is the first type of code segment, directly taking the first code segment as the second code segment;
and under the condition that the first code segment is the second code segment, splitting and data filling are carried out on the first code segment to obtain the second code segment.
5. The method of claim 4, wherein the step of obtaining the second code segment by splitting and data stuffing the first code segment comprises:
taking a code between a data start label and a data end label of the same data label in the first code segment as a code segment to be processed, and replacing a parameter in the code segment to be processed with a parameter value corresponding to the parameter to obtain a second code segment;
and taking a target sub-code segment in the first code segment as the second code segment, wherein codes in the target sub-code segment are continuous and are not positioned between a data start label and a data end label of the same data label.
6. The method as claimed in claim 5, wherein replacing the parameter in the code segment to be processed with the parameter value corresponding to the parameter to obtain the second code segment comprises:
acquiring parameter values corresponding to parameters in the code segment to be processed;
and under the condition that the number of the parameter values is multiple, replacing the multiple parameter values into the code segment to be processed to obtain multiple second code segments, wherein the obtained number of the second code segments is the same as the number of the parameter values, and any two obtained parameter values of the parameters in the second code segments are different.
7. The method according to claim 6, wherein said step of replacing a plurality of said parameter values into said code segment to be processed in case of a plurality of said parameter values, obtaining a plurality of said second code segments comprises:
carrying out serialization processing on the source data containing the plurality of parameter values to obtain a parameter value sequence containing the plurality of parameter values;
and respectively replacing each parameter value in the parameter value sequence into the code segment to be processed to obtain a plurality of second code segments.
8. An apparatus for parsing a front-end code using a tag, comprising:
the system comprises a label acquisition module, a label analysis module and a label analysis module, wherein the label acquisition module is used for acquiring a label in an object code, the object code is a code to be analyzed and used for providing service for a front-end interface, and the label in the object code is a symbol used for distinguishing code segments in the object code;
the code splitting module is used for splitting the target code by using a label in the target code to obtain a code segment set, wherein the code segment set comprises a plurality of first code segments obtained by splitting the target code;
and the code analysis module is used for analyzing the first code segment in the set to obtain a second code segment, wherein the operation result of the second code segment is used for displaying on the front-end interface.
9. An apparatus, comprising: at least one processor, and at least one memory, bus connected with the processor;
the processor and the memory complete mutual communication through the bus;
the processor is configured to invoke program instructions in the memory to perform the method of parsing front-end code with tags of any of claims 1-7.
10. A storage medium having a program stored thereon, wherein the program, when loaded and executed by a processor, implements the method of parsing front end code with tags of any of claims 1-7.
CN201911047210.5A 2019-10-30 2019-10-30 Method, device and equipment for analyzing front-end code by using label Pending CN112748925A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911047210.5A CN112748925A (en) 2019-10-30 2019-10-30 Method, device and equipment for analyzing front-end code by using label

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911047210.5A CN112748925A (en) 2019-10-30 2019-10-30 Method, device and equipment for analyzing front-end code by using label

Publications (1)

Publication Number Publication Date
CN112748925A true CN112748925A (en) 2021-05-04

Family

ID=75641843

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911047210.5A Pending CN112748925A (en) 2019-10-30 2019-10-30 Method, device and equipment for analyzing front-end code by using label

Country Status (1)

Country Link
CN (1) CN112748925A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004242273A (en) * 2002-12-09 2004-08-26 Canon Inc Code data creation method and apparatus
CN104090785A (en) * 2014-06-19 2014-10-08 小米科技有限责任公司 Method, device and system for providing application program
CN105069132A (en) * 2015-08-17 2015-11-18 中国海洋大学 Webpage implementation method based on static shell
CN106559438A (en) * 2015-09-24 2017-04-05 阿里巴巴集团控股有限公司 A kind of program method for uploading and device based on objective network platform
WO2018094087A1 (en) * 2016-11-17 2018-05-24 The Mathworks, Inc. Systems and methods for generating code for parallel processing units
CN109240691A (en) * 2018-09-14 2019-01-18 深圳易嘉恩科技有限公司 Web application system front-end module melts forwarding method
WO2019077607A1 (en) * 2017-10-17 2019-04-25 Argus Cyber Security Ltd. System and method for managing program memory on a storage device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004242273A (en) * 2002-12-09 2004-08-26 Canon Inc Code data creation method and apparatus
CN104090785A (en) * 2014-06-19 2014-10-08 小米科技有限责任公司 Method, device and system for providing application program
CN105069132A (en) * 2015-08-17 2015-11-18 中国海洋大学 Webpage implementation method based on static shell
CN106559438A (en) * 2015-09-24 2017-04-05 阿里巴巴集团控股有限公司 A kind of program method for uploading and device based on objective network platform
WO2018094087A1 (en) * 2016-11-17 2018-05-24 The Mathworks, Inc. Systems and methods for generating code for parallel processing units
WO2019077607A1 (en) * 2017-10-17 2019-04-25 Argus Cyber Security Ltd. System and method for managing program memory on a storage device
CN109240691A (en) * 2018-09-14 2019-01-18 深圳易嘉恩科技有限公司 Web application system front-end module melts forwarding method

Similar Documents

Publication Publication Date Title
CN111414166B (en) Code generation method, device, equipment and storage medium
CN106909361B (en) Web development method and device based on template engine
CN106933887B (en) Data visualization method and device
CN111818123A (en) Network front-end remote playback method, device, equipment and storage medium
CN111143551A (en) Text preprocessing method, classification method, device and equipment
CN116243919A (en) Interface rendering method, device and medium for interpretation rendering and code rendering
CN114359533B (en) Page number identification method based on page text and computer equipment
CN112068911A (en) Method, device, system, equipment and medium for generating electronic form
US10567472B2 (en) Manipulation of PDF files using HTML authoring tools
CN111553652B (en) Service processing method and device
CN112199261A (en) Application program performance analysis method and device and electronic equipment
CN109558548B (en) Method for eliminating CSS style redundancy and related product
CN116301813B (en) Low-code platform development method and system
CN112748925A (en) Method, device and equipment for analyzing front-end code by using label
CN115048083A (en) Visualization method and device for assembly, storage medium and electronic equipment
CN111209028B (en) Data processing method and device, electronic equipment and storage medium
CN108776593B (en) Method and equipment for template configuration in BIOS configuration
CN110110073B (en) Character display method and device
JP2005122398A (en) Dynamic document generating program, recording medium thereof, dynamic document generating device, and dynamic document generating method
CN111240676A (en) Method and device for generating code of skeleton screen
CN112580301A (en) Form verification method, device, equipment and storage medium
CN110956672A (en) Marketing strategy construction method and device
CN116822472B (en) Method and system for rapidly pulling multi-source data to fill complex interface form
CN113792247B (en) Method, apparatus, device and medium for generating functional flow chart based on code characteristics
CN110045961B (en) Management method and management platform of business rules

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