File processing method and device, electronic equipment and storage medium
By analyzing the relationship between functional logic files and object hierarchy, deleting the original entry file, and generating the target entry file, the problem of low function response efficiency caused by the default syntax of the computer programming language is solved, and faster response time and efficiency are achieved.
Patent Information
- Application Number
- CN202311641166.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-01
- Publication Date
- 2025-06-03
AI Technical Summary
The default syntax of computer programming languages causes full loading of functional modules, resulting in long response time, low response efficiency, and even lag.
By obtaining the functional logic file corresponding to the target function, analyzing its control logic, obtaining the target object, and deleting the original entry file in combination with the object hierarchy relationship to generate the target entry file so that only the necessary functional modules are loaded.
It effectively saves the response time of the target function, improves the response efficiency, and avoids the performance problems caused by full loading of functional modules.
Smart Images

Figure CN120086187A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to computer application technologies, and in particular, to a file processing method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of computer technologies, software functions written based on computer programming languages are widely used in various scenarios, such as special effect props in special effect scenarios. Generally, computer programming languages themselves often have specific syntax restrictions and specifications, such as which functions are used for importing and exporting function modules, and what the imported and exported function modules are, etc.
[0003] In related technologies, in order to save development workload and ensure the normal use of functions, the default syntax of computer programming languages is often adopted. This makes it necessary to execute according to a specific logic when the function is executed. For example, when importing function modules, all function modules in the function library need to be loaded. However, the execution of the function may only be related to some function modules in the loaded function library. Then, this way of full loading of function modules will result in a longer overall response time of the function, lower response efficiency, and even jamming. Summary of the Invention
[0004] Embodiments of the present disclosure provide a file processing method, apparatus, electronic device, and storage medium to solve the technical problem of low function response efficiency.
[0005] In a first aspect, embodiments of the present disclosure provide a file processing method, and the method includes:
[0006] Obtain a function logic file corresponding to a target function, and parse the function logic file to obtain a target object corresponding to the target function, where the function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object;
[0007] Obtain an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file, where the object hierarchy relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module;
[0008] Based on the object hierarchy relationship and the target object, delete the content in the original entry file to obtain a target entry file corresponding to the target function.
[0009] In a second aspect, embodiments of the present disclosure further provide a file processing apparatus, and the apparatus includes:
[0010] A functional logic parsing module, configured to obtain a functional logic file corresponding to a target function, parse the functional logic file, and obtain a target object corresponding to the target function, where the functional logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object;
[0011] A hierarchical relationship obtaining module, configured to obtain an original entry file corresponding to the target function and an object hierarchical relationship corresponding to the original entry file, where the object hierarchical relationship is used to indicate the association relationship between each functional module in the function library corresponding to the target function and each functional object in the functional module;
[0012] An entry file adjustment module, configured to delete the content in the original entry file based on the object hierarchical relationship and the target object, so as to obtain a target entry file corresponding to the target function.
[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, which includes:
[0014] One or more processors;
[0015] A storage device, configured to store one or more programs,
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the file processing method according to any one of the embodiments of the present disclosure.
[0017] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium including computer-executable instructions, and the computer-executable instructions are used to execute the file processing method according to any one of the embodiments of the present disclosure when executed by a computer processor.
[0018] The technical solution of the embodiment of the present disclosure can effectively parse the target object associated with the control logic of the target function by obtaining the function logic file corresponding to the target function and parsing the function logic file to obtain the target object corresponding to the target function, providing a basis for deleting the original entry file; then, obtaining the original entry file corresponding to the target function and the object hierarchy relationship corresponding to the original entry file to sort out the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; finally, determining the target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file, and can adjust the original entry file through the function logic file to make the target entry file correspond to the function logic file, ensuring the smooth execution of the function logic file while solving the technical problem of low function response efficiency caused by using the original entry file, saving the response time of the target function, and improving the response efficiency of the target function. Description of the Drawings
[0019] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn to scale.
[0020] Figure 1 It is a flowchart of a file processing method provided by an embodiment of the present disclosure;
[0021] Figure 2 It is a flowchart of another file processing method provided by an embodiment of the present disclosure;
[0022] Figure 3 It is a structural diagram of a file processing device provided by an embodiment of the present disclosure;
[0023] Figure 4 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure. Detailed Embodiments
[0024] The embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for illustrative purposes and are not used to limit the protection scope of the present disclosure.
[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0026] As used herein, the term "including" and its variants are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0031] For example, when responding to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operations of the technical solutions of the present disclosure according to the prompt message.
[0032] As an optional but non-limiting implementation manner, for example, the manner of sending a prompt message to the user in response to receiving an active request from the user may be in the form of a pop-up window, and the prompt message may be presented in text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0033] It should be understood that the above notification and the process of obtaining user authorization are only illustrative and do not limit the implementation manner of the present disclosure. Other manners that comply with relevant laws and regulations can also be applied to the implementation manner of the present disclosure.
[0034] It should be understood that the data involved in the present technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws, regulations and related provisions.
[0035] Figure 1 FIG. is a schematic flowchart of a file processing method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to the situation of optimizing an entry file, especially applicable to the situation where a function logic file is written using JavaScript scripts and the reference of function modules only supports the use of CommonJS. This method can be executed by a file processing device, and the device can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, and the electronic device can be a mobile terminal, a PC or a server, etc.
[0036] As Figure 1 shown, the method of this embodiment may specifically include:
[0037] S110. Obtain a function logic file corresponding to a target function, and parse the function logic file to obtain a target object corresponding to the target function.
[0038] Wherein, the target function is a function for which a corresponding target entry file is to be generated. Exemplarily, the target function can be one or more functions implemented based on an application program. For example, a special effect function implemented based on special effect props in a special effect application or a function implemented based on an integrated functional plugin in other application programs, etc. Specifically, the target function is implemented based on its corresponding function logic file and function associated resources. The function logic file can be understood as a script file including the control logic of the target function. In short, the function logic file is the control logic script of the target function. When the target function is triggered, the target function is implemented by executing the function logic file. Specifically, the target function is implemented by calling a target object in the function logic file. Exemplarily, the target object may include at least one of object types such as function objects, class objects, variable objects, and constant objects. The function associated resources may specifically include resources required for the function logic file to execute during the execution process, such as at least one of resources such as texture resources, text resources, and sound effect resources.
[0039] Specifically, parsing the functional logic file to obtain a target object corresponding to the target function may include: obtaining a functional object that matches a regular expression corresponding to the functional logic file in the functional logic file as the target object corresponding to the target function. With this technical solution, the target object corresponding to the target function can be determined simply, quickly, effectively, and accurately.
[0040] It can be understood that, when the computer programming language adopted by the functional logic file is determined, the regular expression corresponding to the functional logic file can be determined based on the syntax corresponding to the computer programming language.
[0041] In the embodiments of the present disclosure, there may be one or more regular expressions corresponding to the functional logic file. The number of regular expressions corresponding to the functional logic file is related to the syntax it adopts. When there are multiple regular expressions corresponding to the functional logic file, the multiple regular expressions often correspond to different levels and need to be matched level by level to obtain the target object corresponding to the target function.
[0042] Optionally, when there is one regular expression corresponding to the functional logic file, the functional object that matches the regular expression in the functional logic file is used as the target object corresponding to the target function.
[0043] As mentioned above, when there are multiple regular expressions corresponding to the functional logic file, it is necessary to use the regular expressions corresponding to each level to match level by level. Specifically, when there are multiple regular expressions corresponding to the functional logic file, the hierarchical relationship of the regular expressions is determined, and the functional object that matches the regular expression of the last level in the functional logic file is used as the target object corresponding to the target function. With this technical solution, in-depth analysis of the functional logic file can be performed, so as to obtain the specific functional object adopted by the functional logic file, providing effective data support for the accurate deletion of the original entry file.
[0044] S120. Obtain the original entry file corresponding to the target function and the object hierarchical relationship corresponding to the original entry file.
[0045] Among them, the original entry file includes a file index corresponding to each function module in the function library corresponding to the target function. Exemplarily, the file index may be storage path information corresponding to the function module. In some scenarios, the original entry file is also referred to as an index file. The function library can be understood as a tool library for storing function modules. The function module can be understood as a code module for implementing a preset function. In the embodiments of the present disclosure, the function module may be a basic capability module or a general capability module required in the function construction process. For example, the function module may be at least one of modules such as a time module, a logarithm module, a mathematical function module, and a constant module. The function module includes at least one function object. Exemplarily, the function object may include at least one of a function object, a class object, a variable object, and a constant object. Optionally, the encapsulated function module is stored in the function library to facilitate the reuse of the function module, save the time of repeatedly writing the function module, save time and effort, and improve the development efficiency.
[0046] In the embodiments of the present disclosure, the object hierarchy relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module. Exemplarily, the object hierarchy relationship may be stored in a tree structure or a table form, etc. Each level in the object hierarchy relationship represents the hierarchical relationship between the function module and the function object in the function library. For example, in the case of the tree structure of the object hierarchy relationship, the function library can be used as the root node, each function module is used as the first-level leaf node of different branches of the root node respectively, and based on the dependency relationship between the function module and the function object, the leaf nodes of the function module, that is, the second-level leaf nodes, and the leaf nodes of the second-level leaf nodes are determined, and so on, to construct the tree structure of the object hierarchy relationship. For example, the first-level leaf node of the root node function library may be a time module, and the leaf node of the time module, that is, the second-level leaf node, may be an exported object of the time module.
[0047] Specifically, obtaining the original entry file corresponding to the target function can support the reference to any function module in the function library. Furthermore, obtaining the object hierarchy relationship corresponding to the original entry file can intuitively understand the association relationship between each function module and the function object in the function library, providing information support for the subsequent optimization of the original entry file.
[0048] S130. Determine a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
[0049] Optionally, adjust the original entry file based on the object hierarchy relationship and the target object to obtain a target entry file corresponding to the target function. Specifically, the content in the original entry file can be deleted based on the object hierarchy relationship and the target object to obtain a target entry file corresponding to the target function.
[0050] Exemplarily, when the original entry file is a script file, the content in the original entry file can be execution statements in the script.
[0051] Specifically, determine the function modules associated with the target object based on the object hierarchy relationship, retain the content in the original entry file that includes the target object and its associated function modules, and delete other content, so as to obtain a target entry file corresponding to the target function. By screening the text of the function logic script in the target function before the target function runs formally, filtering out which target objects in the function modules are used, and then specifically removing the function modules, only retaining the used function modules, thereby realizing the trimming of the function modules in the original entry file.
[0052] Since the target entry file no longer contains the import module of the function module irrelevant to the target object, even if the function module in the function library is not deleted, it will not be loaded. Thus, without changing the function modules in the function library, it can not only ensure that the target object in the function logic file can be successfully referenced, but also reduce the loading of other function modules, saving time and space resources.
[0053] Adopting this technical solution can effectively and accurately delete the content in the original entry file that is irrelevant to the function logic file, retain the content related to the function logic file, while ensuring the smooth execution of the function logic file, reduce the loading of unnecessary function modules, solve the technical problem of low function response efficiency, save the response time of the target function, and improve the response efficiency of the target function.
[0054] Optionally, based on the object hierarchy relationship and the target object, obtain the target file content from the original entry file, and generate a target entry file corresponding to the target function based on the target file content. Specifically, obtaining the target file content from the original entry file based on the object hierarchy relationship and the target object may include: determining an associated object corresponding to the target object based on the object hierarchy relationship and the target object; obtaining the content associated with the target object and the associated object from the original entry file as the target file content. By adopting this technical solution, while generating the target entry file, the original entry file can be retained to support the reuse of the original entry file. Moreover, when there is a problem with the target entry file, the original entry file can also be used to execute the target function.
[0055] Based on any optional technical solution in the embodiments of the present disclosure, after obtaining the target entry file corresponding to the target function, it may further include: when executing the functional logic file, calling the function modules in the function library through the target entry file. By adopting this technical solution, when loading the function modules corresponding to the target entry file, it is possible to only load the function modules that the functional logic file will reference in the function library, avoiding the waste of space resources and time caused by the full loading of function modules, thereby effectively improving the response efficiency of the target function.
[0056] The technical solution of the embodiments of the present disclosure can effectively parse out the target object associated with the control logic of the target function by obtaining the functional logic file corresponding to the target function and parsing the functional logic file to obtain the target object corresponding to the target function, providing a basis for deleting the original entry file; then, obtaining the original entry file corresponding to the target function and the object hierarchy relationship corresponding to the original entry file to sort out the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; finally, deleting the content in the original entry file based on the object hierarchy relationship and the target object to obtain the target entry file corresponding to the target function. Determining the target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file can adjust the original entry file through the functional logic file so that the target entry file corresponds to the functional logic file, ensuring the smooth execution of the functional logic file while solving the technical problem of low functional response efficiency caused by using the original entry file, saving the response time of the target function, and improving the response efficiency of the target function.
[0057] Figure 2Schematic diagram of another file processing method provided by an embodiment of the present disclosure. Based on the technical solution of the above embodiment, the method for obtaining the object hierarchy relationship is further refined. Optionally, obtain an original entry file corresponding to the target function, where the original entry file includes file indexes corresponding to each function module in the function library corresponding to the target function; at least one function object is included in the function module, and the function object includes at least one of a function object, a class object, a variable object, and a constant object; parse the original entry file to obtain the object hierarchy relationship between each function module and the function object in the function library, and store the object hierarchy relationship corresponding to the original entry file. For specific implementation manners, reference may be made to the description of this embodiment. Technical features that are the same as or similar to those of the foregoing embodiments will not be described herein again.
[0058] As Figure 2 shown, the method of this embodiment may specifically include:
[0059] S210. Obtain a function logic file corresponding to the target function, and parse the function logic file to obtain a target object corresponding to the target function.
[0060] S220. Obtain an original entry file corresponding to the target function, where the original entry file includes file indexes corresponding to each function module in the function library corresponding to the target function; at least one function object is included in the function module.
[0061] It should be noted that the original entry file is associated with the function library. Different functions may correspond to the same function library or different function libraries. Then, the original entry files corresponding to different functions may be the same or different.
[0062] Optionally, obtaining the original entry file corresponding to the target function includes: editing the original entry file corresponding to the target function, or obtaining the pre-edited original entry file corresponding to the target function.
[0063] S230. Parse the original entry file to obtain the object hierarchy relationship between each function module and the function object in the function library, and store the object hierarchy relationship corresponding to the original entry file.
[0064] Considering that the syntax format of the original entry file is often relatively unified, therefore, a method for filtering strings that is common to a computer language, a regular expression, can be used to filter out multiple function modules corresponding to the function library and function objects included in the function module from the entry file.
[0065] Specifically, parsing the original entry file to obtain the object hierarchy relationship between each function module and the function object in the function library may include: determining the function module or the function object corresponding to each level in the original entry file based on a pre-set regular expression corresponding to the function object of each level; determining the object hierarchy relationship between each function module and the function object in the function library based on the function object, the level corresponding to the function object, and the association relationship between the levels. By using the method of regular expression matching, it is possible to simply, quickly, and accurately determine the function module and function object corresponding to the function library through the original entry file. Moreover, the association relationship between the levels represents the hierarchical relationship between the function module and the function object, enabling the rapid establishment of the object hierarchy relationship.
[0066] Similar to the parsing of the original entry file, the expressions corresponding to each level can be determined respectively, and then the regular expressions corresponding to each level are used to perform matching level by level to obtain the function module and function object corresponding to the function library. Then, the association relationship between the function module and the function object is established according to the relationship between the levels, thereby obtaining the object hierarchy relationship.
[0067] S240. Determine the target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
[0068] In the embodiments of the present disclosure, there are various ways to delete the content in the original entry file based on the object hierarchy relationship and the target object. Optionally, the function modules associated with each target object can be determined respectively based on the object hierarchy relationship as the associated modules corresponding to the target objects; the content in the original entry file is deleted based on the target object and the associated modules. By adopting this technical solution, not only the target object itself involved in the function logic file is focused on, but also the function modules associated with the target object in the original entry file can be effectively determined, ensuring the data integrity of the target object and laying a foundation for the successful execution of the target object after the deletion of the original entry file.
[0069] Specifically, determining the function modules associated with each of the target objects based on the object hierarchy relationship as the associated modules corresponding to the target objects includes: determining the highest-level function module associated with the target object based on the object hierarchy relationship as the associated module corresponding to the target object. Taking the tree structure as an example, it is possible to query level by level from the leaf node where the target object is located towards the root node according to the object hierarchy relationship to determine the function module closest to the root node associated with the target object, that is, the highest-level function module. Exemplarily, the associated module includes the function module of the target object and other function modules that have a dependency relationship with the target object, etc. By adopting the above technical solution, it can fully ensure the successful execution of the target object, and retaining it in units of function modules can improve the efficiency of content deletion in the subsequent original entry file.
[0070] Optionally, deleting the content in the original entry file based on the target object and the associated module includes: retaining the content in the original entry file corresponding to the associated module and deleting other content in the original entry file. Exemplarily, it is possible to first filter out the content with keywords corresponding to the associated module of the target object and the content of the function object that loads the time module. Then, filter out the content with keywords corresponding to the target object, such as the content that exports the target object. Then retain the filtered content and delete the remaining content. In this way, the function modules used in the function logic file and the specific exported target objects are retained in the original entry file, and the rest are deleted. Then, when running the function logic file, the number of files in the loaded function library is greatly reduced, optimizing the lag problem.
[0071] In the technical solution of the embodiments of the present disclosure, the file index corresponding to each function module in the function library corresponding to the target function is recorded in the original entry file corresponding to the target function. Therefore, when the target function is used, the function object in the function module in the function library can be called through the original entry file, thus ensuring the successful response of the target function. Then, by parsing the original entry file, the object hierarchy relationship between each function module and the function object in the function library can be obtained, enabling refined analysis of the function modules and function objects in the function library, and storing the object hierarchy relationship corresponding to the original entry file, thereby structurally storing the function modules and function objects through the object hierarchy relationship, providing a basis for subsequent content deletion of the original entry file.
[0072] Figure 3 The structural schematic diagram of a file processing device provided by the embodiments of the present disclosure is as Figure 3As shown in the figure, the document processing device includes: a function logic parsing module 310, a hierarchical relationship obtaining module 320, and an entry file adjustment module 330.
[0073] Among them, the function logic parsing module 310 is used to obtain a function logic file corresponding to the target function, parse the function logic file, and obtain a target object corresponding to the target function. The function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; the hierarchical relationship obtaining module 320 is used to obtain an original entry file corresponding to the target function and an object hierarchical relationship corresponding to the original entry file, where the object hierarchical relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; the entry file adjustment module 330 is used to determine a target entry file corresponding to the target function based on the object hierarchical relationship, the target object, and the original entry file.
[0074] The technical solution of the embodiment of the present disclosure can effectively parse out the target object associated with the control logic of the target function by obtaining the function logic file corresponding to the target function through the function logic parsing module and parsing the function logic file to obtain the target object corresponding to the target function, providing a basis for deleting the original entry file; then, the hierarchical relationship obtaining module is used to obtain the original entry file corresponding to the target function and the object hierarchical relationship corresponding to the original entry file to sort out the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; finally, the entry file adjustment module deletes the content in the original entry file based on the object hierarchical relationship and the target object to obtain a target entry file corresponding to the target function, and determines a target entry file corresponding to the target function based on the object hierarchical relationship, the target object, and the original entry file. It can adjust the original entry file through the function logic file so that the target entry file corresponds to the function logic file, ensuring the smooth execution of the function logic file while solving the technical problem of low function response efficiency caused by using the original entry file, saving the response time of the target function, and improving the response efficiency of the target function.
[0075] Based on any of the above optional technical solutions, optionally, the hierarchical relationship acquisition module 320 includes an original entry file acquisition unit and a hierarchical relationship parsing unit. Among them, the original entry file acquisition unit is used to acquire the original entry file corresponding to the target function, where the original entry file includes file indexes corresponding to each function module in the function library corresponding to the target function; at least one function object is included in the function module, and the function object includes at least one of a function object, a class object, a variable object, and a constant object; the hierarchical relationship parsing unit is used to parse the original entry file to obtain the object hierarchical relationship between each function module and the function object in the function library, and store the object hierarchical relationship corresponding to the original entry file.
[0076] Based on any of the above optional technical solutions, optionally, the hierarchical relationship parsing unit includes: a file-by-layer parsing subunit and an association relationship determination subunit. Among them, the file-by-layer parsing subunit is used to determine the function module or the function object corresponding to each layer in the original entry file based on a regular expression preset for each layer of the function object; the association relationship determination subunit determines the object hierarchical relationship between each function module and the function object in the function library based on the function object, the layer corresponding to the function object, and the association relationship between the layers.
[0077] Based on any of the above optional technical solutions, optionally, the entry file adjustment module 330 includes: an entry file deletion module and a file content acquisition module. Among them, the entry file deletion module is used to delete the content in the original entry file based on the object hierarchical relationship and the target object to obtain a target entry file corresponding to the target function; or, the file content acquisition module, which is an entry file extraction module, is used to obtain target file content from the original entry file based on the object hierarchical relationship and the target object, and generate a target entry file corresponding to the target function based on the target file content.
[0078] Based on any of the above optional technical solutions, optionally, the entry file deletion unit includes: an associated module determination subunit and a file content deletion subunit. Among them, the associated module determination subunit is used to respectively determine the function modules associated with each target object based on the object hierarchical relationship as the associated modules corresponding to the target objects; the file content deletion subunit is used to delete the content in the original entry file based on the target object and the associated module.
[0079] Based on any of the above optional technical solutions, optionally, the associated module determination subunit is specifically configured to: determine the highest-level functional module associated with the target object based on the object hierarchy relationship, and use it as the associated module corresponding to the target object.
[0080] Based on any of the above optional technical solutions, optionally, the file content deletion subunit is specifically configured to: retain the content corresponding to the associated module in the original entry file, and delete other content in the original entry file.
[0081] Based on any of the above optional technical solutions, optionally, the functional logic parsing module 310 is configured to: obtain a functional object that matches the regular expression corresponding to the functional logic file in the functional logic file, and use it as the target object corresponding to the target function.
[0082] Based on any of the above optional technical solutions, optionally, the functional logic parsing module 310 is specifically configured to: when there are multiple regular expressions corresponding to the functional logic file, determine the hierarchical relationship of the regular expressions, and use the functional object that matches the last-level regular expression in the functional logic file as the target object corresponding to the target function.
[0083] Based on any of the above optional technical solutions, optionally, the function processing module further includes: a functional logic file execution module. The functional logic file execution module is configured to, after obtaining the target entry file corresponding to the target function, when executing the functional logic file, call the functional module in the function library through the target entry file.
[0084] The file processing device provided by the embodiments of the present disclosure can execute the file processing method provided by any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for executing the method.
[0085] It should be noted that the various units and modules included in the above device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the embodiments of the present disclosure.
[0086] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. Next, refer to Figure 4 , which shows an electronic device suitable for implementing the embodiments of the present disclosure (such as Figure 4Schematic diagram of the structure of the terminal device or server) 400 in. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0087] As Figure 4 shown, the electronic device 400 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 401, which may perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage device 408 into the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. The editing / output (I / O) interface 405 is also connected to the bus 404.
[0088] Generally, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 4 the electronic device 400 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had.
[0089] Specifically, according to the embodiments of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above functions defined in the methods of the embodiments of the present disclosure are executed.
[0090] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0091] The electronic device provided in the embodiments of the present disclosure and the document processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be referred to in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0092] The embodiments of the present disclosure provide a computer storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the document processing method provided in the above embodiments.
[0093] It should be noted that the computer-readable medium in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0094] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0095] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.
[0096] The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the electronic device, the electronic device is caused to: obtain a function logic file corresponding to a target function, parse the function logic file to obtain a target object corresponding to the target function, where the function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; obtain an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file, where the object hierarchy relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; determine a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
[0097] Computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).
[0098] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.
[0099] The units described in the embodiments of the present disclosure can be implemented in software or in hardware. Among them, the name of the unit does not constitute a limitation on the unit itself in some cases. For example, the first acquisition unit can also be described as "the unit for acquiring at least two Internet protocol addresses".
[0100] The functions described above herein can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
[0101] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM or Flash memory), an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0102] According to one or more embodiments of the present disclosure, [Example 1] provides a file processing method, including: obtaining a functional logic file corresponding to a target function, parsing the functional logic file to obtain a target object corresponding to the target function, where the functional logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; obtaining an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file, where the object hierarchy relationship is used to indicate the association relationship between each functional module in the function library corresponding to the target function and each of the functional objects in the functional module; determining a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
[0103] According to one or more embodiments of the present disclosure, [Example 2] provides the method of Example 1, further including:
[0104] Optionally, the obtaining an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file includes: obtaining an original entry file corresponding to the target function, where the original entry file includes a file index corresponding to each functional module in the function library corresponding to the target function; each functional module includes at least one functional object, and the functional object includes at least one of a function object, a class object, a variable object, and a constant object; parsing the original entry file to obtain the object hierarchy relationship between each functional module and the functional object in the function library, and storing the object hierarchy relationship corresponding to the original entry file.
[0105] According to one or more embodiments of the present disclosure, [Example 3] provides the method of Example 2, further including:
[0106] Optionally, the parsing the original entry file to obtain the object hierarchy relationship between each functional module and the functional object in the function library includes: determining the functional module or the functional object corresponding to each level in the original entry file based on a regular expression preset for each level of the functional object; determining the object hierarchy relationship between each functional module and the functional object in the function library based on the functional object, the level corresponding to the functional object, and the association relationship between the levels.
[0107] According to one or more embodiments of the present disclosure, [Example 4] provides the method of Example 1 or Example 2, further including:
[0108] Optionally, determining the target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file includes: deleting the content in the original entry file based on the object hierarchy relationship and the target object to obtain the target entry file corresponding to the target function; or, obtaining target file content from the original entry file based on the object hierarchy relationship and the target object, and generating the target entry file corresponding to the target function based on the target file content.
[0109] According to one or more embodiments of the present disclosure, [Example Five] provides the method of Example Four, and further includes:
[0110] Optionally, deleting the content in the original entry file based on the object hierarchy relationship and the target object includes: respectively determining, based on the object hierarchy relationship, the function modules associated with each target object as the associated modules corresponding to the target object; and deleting the content in the original entry file based on the target object and the associated modules.
[0111] According to one or more embodiments of the present disclosure, [Example Six] provides the method of Example Five, and further includes:
[0112] Optionally, respectively determining, based on the object hierarchy relationship, the function modules associated with each target object as the associated modules corresponding to the target object includes: determining, based on the object hierarchy relationship, the highest-level function module associated with the target object as the associated module corresponding to the target object.
[0113] According to one or more embodiments of the present disclosure, [Example Seven] provides the method of Example Five, and further includes:
[0114] Optionally, deleting the content in the original entry file based on the target object and the associated modules includes: retaining the content in the original entry file corresponding to the associated modules, and deleting the other content in the original entry file.
[0115] According to one or more embodiments of the present disclosure, [Example Eight] provides the method of Example One, and further includes:
[0116] Optionally, parsing the function logic file to obtain the target object corresponding to the target function includes: obtaining the function object that matches the regular expression corresponding to the function logic file in the function logic file as the target object corresponding to the target function.
[0117] According to one or more embodiments of the present disclosure, [Example Nine] provides the method of Example Eight, and further includes:
[0118] Optionally, obtaining a function object that matches a regular expression corresponding to the function logic file as a target object corresponding to the target function includes: when there are multiple regular expressions corresponding to the function logic file, determining a hierarchical relationship of the regular expressions, and using the function object that matches the regular expression of the last level in the function logic file as the target object corresponding to the target function.
[0119] According to one or more embodiments of the present disclosure, [Example Ten] provides the method of Example One, further including:
[0120] Optionally, after obtaining the target entry file corresponding to the target function, it further includes: when executing the function logic file, calling a function module in the function library through the target entry file.
[0121] According to one or more embodiments of the present disclosure, [Example Eleven] provides a file processing device, including: a function logic parsing module, configured to obtain a function logic file corresponding to a target function, and parse the function logic file to obtain a target object corresponding to the target function, where the function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; a hierarchical relationship obtaining module, configured to obtain an original entry file corresponding to the target function and an object hierarchical relationship corresponding to the original entry file, where the object hierarchical relationship is used to indicate an association relationship between each function module in the function library corresponding to the target function and each function object in the function module; an entry file adjustment module, configured to determine a target entry file corresponding to the target function based on the object hierarchical relationship, the target object, and the original entry file.
[0122] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principle. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solution formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, a technical solution formed by mutually replacing the above features with (but not limited to) technical features having similar functions disclosed in the present disclosure.
[0123] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the foregoing discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0124] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A file processing method, characterized in that, it includes: obtaining a function logic file corresponding to a target function, parsing the function logic file to obtain a target object corresponding to the target function, wherein the function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; obtaining an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file, wherein the object hierarchy relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; determining a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
2. The file processing method according to claim 1, characterized in that, the obtaining an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file includes: obtaining an original entry file corresponding to the target function, wherein the original entry file includes a file index corresponding to each function module in the function library corresponding to the target function; at least one function object is included in the function module, and the function object includes at least one of a function object, a class object, a variable object, and a constant object; parsing the original entry file to obtain the object hierarchy relationship between each function module and the function object in the function library, and storing the object hierarchy relationship corresponding to the original entry file.
3. The file processing method according to claim 2, characterized in that, the parsing the original entry file to obtain the object hierarchy relationship between each function module and the function object in the function library includes: determining the function module or the function object corresponding to each level in the original entry file based on a pre-set regular expression corresponding to each level of the function object; determining the object hierarchy relationship between each function module and the function object in the function library based on the function object, the level corresponding to the function object, and the association relationship between the levels.
4. The file processing method according to claim 1 or 2, characterized in that, the determining a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file includes: deleting the content in the original entry file based on the object hierarchy relationship and the target object to obtain a target entry file corresponding to the target function; or, obtaining target file content from the original entry file based on the object hierarchy relationship and the target object, and generating a target entry file corresponding to the target function based on the target file content.
5. The file processing method according to claim 4, characterized in that, Deleting the content in the original entry file based on the object hierarchy relationship and the target object includes: Based on the object hierarchy relationship, respectively determining the function modules associated with each target object as the associated modules corresponding to the target object; Deleting the content in the original entry file based on the target object and the associated module.
6. The file processing method according to claim 5, wherein, the step of respectively determining the function modules associated with each target object based on the object hierarchy relationship as the associated modules corresponding to the target object includes: Based on the object hierarchy relationship, determining the highest-level function module associated with the target object as the associated module corresponding to the target object.
7. The file processing method according to claim 5, wherein, the step of deleting the content in the original entry file based on the target object and the associated module includes: Retaining the content in the original entry file corresponding to the associated module and deleting the other content in the original entry file.
8. The file processing method according to claim 1, wherein, the step of parsing the function logic file to obtain the target object corresponding to the target function includes: Obtaining the function object that matches the regular expression corresponding to the function logic file in the function logic file as the target object corresponding to the target function.
9. The file processing method according to claim 8, wherein, the step of obtaining the function object that matches the regular expression corresponding to the function logic file in the function logic file as the target object corresponding to the target function includes: In the case where there are multiple regular expressions corresponding to the function logic file, determining the hierarchical relationship of the regular expressions, and using the function object that matches the last-level regular expression in the function logic file as the target object corresponding to the target function.
10. The file processing method according to claim 1, wherein, after obtaining the target entry file corresponding to the target function, it further includes: When executing the function logic file, calling the function module in the function library through the target entry file.
11. A file processing device, wherein, it includes: A function logic parsing module, configured to obtain a function logic file corresponding to a target function, parse the function logic file, and obtain a target object corresponding to the target function, wherein the function logic file is a script file including the control logic of the target function; the target object includes at least one of a function object, a class object, a variable object, and a constant object; A hierarchy relationship obtaining module, configured to obtain an original entry file corresponding to the target function and an object hierarchy relationship corresponding to the original entry file, wherein the object hierarchy relationship is used to indicate the association relationship between each function module in the function library corresponding to the target function and each function object in the function module; An entry file adjustment module, configured to determine a target entry file corresponding to the target function based on the object hierarchy relationship, the target object, and the original entry file.
12. An electronic device, characterized in that the electronic device includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the file processing method according to any one of claims 1-10.
13. A storage medium containing computer-executable instructions, characterized in that the computer-executable instructions are used to execute the file processing method according to any one of claims 1-10 when executed by a computer processor.