Visual range code validity determination method, electronic equipment and medium
By dividing the pending visual range into multiple continuous visual ranges and obtaining the code validity data of the conditional compiled statements, the problem in the prior art is difficult to quickly and accurately judge the code validity of the conditional compiled statements, and efficient and accurate judgment of the code is achieved.
Patent Information
- Application Number
- CN202411704753.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-26
AI Technical Summary
It is difficult for prior art to quickly and accurately determine the effectiveness of conditional compilation statement code in the visual range, especially when faced with oversized files and conditional compilation syntax.
By dividing the pending visual range into multiple continuous visual ranges, the code validity data corresponding to the conditional compilation statement is obtained, and the validity of the conditional compilation statement code in each continuous visual range is determined based on the overlapping relationship.
It improves the efficiency and accuracy of the code validity of conditional compilation statements within the visual range, and can quickly and accurately determine the validity of conditional compilation statements.
Smart Images

Figure CN119621069A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method for determining the validity of a visible range code, an electronic device and a medium. Background Art
[0002] For common source code viewing and editing software, in order to display codes in different languages in a personalized way, it is usually necessary to perform lexical analysis on the source code of different languages, so as to correctly identify the type and value of each word, as well as the approximate relationship between them, so as to correctly perform subsequent coloring, highlighting, and statement block recognition. In order to correctly parse the lexical meaning of a single file, traditional lexical analysis algorithms often need to traverse and analyze the entire file from the beginning. However, this algorithm often requires a long initial loading time when facing an extremely large file.
[0003] In order to improve the speed of first loading, the existing scheme is to parse the source code content that needs to be displayed in the visible range first. However, the scheme does not obtain a complete source code organizational structure, and there may be code folding, code hiding and other situations in the visible range, making the code in the pending visible range discontinuous. When encountering SystemVerilog and other support conditional compilation syntax (such as: `ifdef, `ifndef, `eles, `elsif, `endif), since the conditional compilation syntax is truly effective only when the condition is established, it is difficult for the prior art to correctly identify whether the text content in each conditional compilation module in the visible range participates in the current compilation. It can be seen from this that how to quickly and accurately determine the validity of the conditional compilation statement code in the visible range has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The object of the present invention is to provide a method, electronic device and medium for determining the validity of code in a visible range, which can quickly and accurately determine the validity of conditional compilation statement codes in a visible range.
[0005] According to a first aspect of the present invention, a method for determining the validity of a visible range code is provided, comprising:
[0006] Step S1: Divide the visible range to be processed into M continuous visible ranges {G1, G2, ..., G m ,…,G M},G m is the mth continuous visible range, the value range of m is 1 to M, G1, G2, …, G m ,…,G M Arrange in order of code position;
[0007] Step S2. Obtain the code validity data {A1, A2, …, A n , …, A N} corresponding to the conditional compilation statements during the source code compilation process. A n is the code validity data corresponding to the nth group of conditional compilation statements, where the value range of n is from 1 to N, and N is the total number of groups of code validity data corresponding to the conditional compilation statements. A1, A2, …, A n , …, A N are arranged in the order of the code positions. A n includes the code position information and code validity information of the nth top-level conditional compilation statement, as well as the code position information and code validity information of all descendant conditional compilation statements nested by the nth top-level conditional compilation statement;
[0008] Step S3. Initially set m = 1, initially set the preset pointer to point to A1, and initially set n = 1;
[0009] Step S4. Obtain the starting position SCn and ending position ECn corresponding to A n ;
[0010] Step S5. If ECn < SV, execute Step S7; if SCn > EV, set the current preset pointer to point to A n-1 , and execute Step S8; otherwise, execute Step S6. Here, SV is the starting position of G m , and EV is the ending position of G m ;
[0011] Step S6. Obtain the overlapping part AT m between G n and A n = [STP n , ETP n . STP n is the starting position of AT n , and ETP n is the ending position of AT n ;
[0012] Step S7. If n < N, then set n = n + 1, set the current preset pointer to point to A n , and return to execute Step S4. If n = N and ECn ≤ EV, set the current preset pointer to be empty and execute Step S8. If n = N and ECn > EV, execute Step S8;
[0013] Step S8. Determine the validity of the conditional compilation statement code in G n , …, A N} based on the code validity information corresponding to the overlapping part; m
[0014] Step S9: If m < M, set m = m + 1 and return to execute Step S5. If m = M or the current preset pointer points to null, end the process.
[0015] According to a second aspect of the present invention, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the first aspect of the present invention.
[0016] According to a third aspect of the present invention, there is provided a computer-readable storage medium storing computer-executable instructions, and the computer instructions are used to execute the method described in the first aspect of the present invention.
[0017] The present invention has obvious advantages and beneficial effects compared with the prior art. By means of the above technical solution, a method, an electronic device and a medium for determining the validity of a visible range code provided by the present invention can achieve considerable technical progressiveness and practicality, and have wide industrial utilization value. It has at least the following beneficial effects:
[0018] The present invention first divides the to-be-processed visible range into multiple consecutive visible ranges, obtains the code validity data corresponding to the conditional compilation statements, and then determines the validity of the conditional compilation statement codes in each consecutive visible range based on the code validity data corresponding to the conditional compilation statements and the overlapping relationship between each consecutive visible range and the conditional compilation statements, so as to determine the validity of the to-be-processed visible range code, improving the efficiency and accuracy of judging the validity of the conditional compilation statement codes within the visible range. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0020] Figure 1 It is a schematic diagram of a method for determining the validity of a visible range code provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, rather than all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.
[0022] The embodiment of the present invention provides a method for determining the validity of a visible range code, such as Figure 1 As shown, including:
[0023] Step S1: Divide the visible range to be processed into M continuous visible ranges {G1, G2, ..., G m ,…,G M},G m is the mth continuous visible range, the value range of m is 1 to M, G1, G2, …, G m ,…,G M Arrange in order of code location.
[0024] It should be noted that there may be code folding, code hiding, etc. in the visible scope to be processed, which makes the code in the visible scope to be processed discontinuous. Therefore, it is necessary to first divide the code in the visible scope to be processed into multiple continuous visible scopes, and then perform the judgment of the validity of the conditional compilation statement code on each visible scope. It should be noted that the continuous visible scope refers to the visible scope with continuous code line numbers.
[0025] Step S2: Obtain code validity data {A1, A2, ..., A1, A2, ..., A2, A1, A2 ... n ,…,A N}, A n is the code validity data corresponding to the nth group of conditional compilation statements, where n ranges from 1 to N, and N is the total number of code validity data groups corresponding to conditional compilation statements, A1, A2, …, A n ,…,A N Arrange in order of code position, A n It includes the code location information and code validity information of the nth top-level conditional compilation statement and the code location information and code validity information of all descendant conditional compilation statements nested within the nth top-level conditional compilation statement.
[0026] Among them, conditional compilation statements include `ifdef statements, `ifndef statements, `eles statements, `elsif statements, `endif statements, etc. One or more layers of conditional compilation statements can be nested in a conditional compilation statement. During the compilation process of each conditional compilation statement, the compiler can obtain the corresponding code validity, and thus generate code validity data corresponding to the conditional compilation statement during the compilation process. It should be noted that the top-level conditional compilation statement refers to a conditional compilation statement that has no parent conditional compilation statement in the source code. The code validity data corresponding to each top-level conditional compilation statement and all descendant conditional compilation statements nested by the top-level conditional compilation statement constitute a set of code validity data corresponding to the conditional compilation statement.
[0027] Step S3: Initially set m = 1, initially set the preset pointer to point to A1, and initially set n = 1.
[0028] Among them, in order to ensure that the judgment of A is not omitted and reduce the repeated judgment of the same A, n a preset pointer can be set to record the position of A judged to. n n
[0029] Step S4: Obtain the starting SCn and ending position ECn corresponding to A. n
[0030] Step S5: If ECn < SV, execute Step S7; if SCn > EV, set the current preset pointer to point to A, n-1 execute Step S8; otherwise, execute Step S6, where SV is the starting position of G, m and EV is the ending position of G. m
[0031] It should be noted that if ECn < SV, it means that the top-level conditional compilation statement in the current A is before G, and there is no overlapping part between them. However, whether there is an overlapping part with the subsequent top-level conditional compilation statements needs to be further judged, so Step S7 is executed. If SCn > EV, it means that the top-level conditional compilation statement in the current A is after the to-be-processed continuous visible range, and there is no overlapping part between them, and there is also no possibility of overlapping with the subsequent top-level conditional compilation statements. And the top-level conditional compilation statement in A may overlap with the next to-be-processed continuous visible range. Therefore, it is necessary to set the current preset pointer to point to A to avoid missing the overlapping part of the next to-be-processed continuous visible range, and then execute Step S8. If neither ECn < SV nor SCn > EV is satisfied, then the top-level conditional compilation statement in the current A must overlap with the to-be-processed continuous visible range. n m n n-1 n-1 n
[0032] Step S6: Obtain the overlapping part AT = [STP, ETP] of G and A, where STP is the starting position of AT, m n and ETP is the ending position of AT. n n n n n n n
[0033] Among them, STP n = max(SV, SCn), ETP n = min(EV, ECn), where max(SV, SCn) means obtaining the larger value between SV and SCn, and min(EV, ECn) means obtaining the smaller value between EV and ECn.
[0034] Step S7: If n < N, then set n = n + 1, and set the current preset pointer to point to A n , return to execute Step S4. If n = N and ECn ≤ EV, set the current preset pointer to be empty, and execute Step S8. If n = N and ECn > EV, execute Step S8.
[0035] It should be noted that except for the case where SCn > EV in Step S5, the next consecutive visible range to be processed can directly start judging the overlapping area from the current A n to ensure that no overlapping area is missed. Therefore, in Step S7, after updating the value of n, directly set the current preset pointer to point to A n , and only when SCn > EV, is it necessary to set the current preset pointer to point to A n-1 . When n = N and ECn ≤ EV, it means that all A n have been judged, so set the current preset pointer to be empty. If n = N and ECn > EV, execute Step S8, then the next consecutive visible range to be processed may overlap with A N , so further judgment is still needed.
[0036] Step S8: Determine the validity of the conditional compilation statement code in G n ,…, A N} based on the code validity information corresponding to the overlapping part in {A1, A2, …, A m in the overlapping part.
[0037] Step S9: If m < M, then set m = m + 1, return to execute Step S5. If m = M or the current preset pointer is empty, then end the process.
[0038] As an embodiment, Step S1 includes:
[0039] Step S11: Set dividing lines at the folding positions and code hiding positions in the visible range to be processed, and generate M consecutive visible ranges {G1, G2, …, G m ,…, G M}.
[0040] It should be noted that the folding positions and code hiding positions in the visible range will make the code in the visible range discontinuous. By setting dividing lines at the folding positions and code hiding positions in the visible range to be processed, all the obtained visible ranges are continuous visible ranges.
[0041] In order to make the divided continuous visible range as balanced as possible, the larger continuous visible range can be further divided so that the divided continuous visible range is as balanced as possible. Step S1 includes:
[0042] Step S01, setting dividing lines at the folding position and the code hiding position in the visible range to be processed, if the number of code lines in each continuous visible range is less than or equal to the preset code line number threshold, then executing step S03, otherwise, executing step S02.
[0043] Step S02: Evenly divide the continuous visible range whose number of code lines is greater than a preset code line threshold into multiple continuous visible ranges, so that the number of code lines in each continuous visible range is less than or equal to the preset code line threshold.
[0044] Step S03: Generate M continuous visible ranges {G1, G2, ..., G m ,…,G M}
[0045] As an embodiment, step S4 includes:
[0046] Step S41: n The starting position of the top-level conditional compilation statement is determined as A n The corresponding starting position SCn;
[0047] Step S42: A n The sum of the starting position and the corresponding text length of the top-level conditional compilation statement is determined as A n The corresponding end position ECn.
[0048] It should be noted that the position information in the source code is determined based on the row and column positions. When the starting position is known, the ending position can be obtained by adding the text length.
[0049] As an example, A n = {B1 n ,B2 n ,…,B x n ,…,B f(n) n ,U n}, where B x n A n The code validity data corresponding to the xth conditional compilation statement in , where the value of x ranges from 1 to f(n), and f(n) is A n The total number of conditional compilation statements in {B1 n,B2 n ,…,B x n ,…,B f(n) n ,U n} There is a top-level conditional compilation statement corresponding to B x n , other B x n All B x n The corresponding conditional compilation statements are nested to form a top-level conditional compilation statement. n For B x n The parent-child relationship information between them, that is, U n It is clearly recorded in B x n The hierarchical relationship of each B x n The corresponding parent B x n and sub-B x n Available at U n It can be understood that the top-level conditional compilation statement corresponds to B x n Parent B does not exist x n , the leaf conditional compilation statement corresponds to B x n Sub B does not exist x n .
[0050] B x n = {BF xn ,BL xn ,BV xn}, where BF xn A n The starting position corresponding to the xth conditional compilation statement, BL xn A n The length of the text corresponding to the xth conditional compilation statement, BV xn A n The compilation status corresponding to the xth conditional compilation statement in the compilation state includes two states: valid and invalid.
[0051] As an embodiment, in step S8, all conditional compilation statement codes in the continuous visible range to be processed are set to a valid state by default. n When there are one or more overlapping parts, for each A nThe overlapping part AT n Execute:
[0052] Step S81, Initial setting AT n For the overlapping part to be processed, initially set the hierarchy identifier t = 1, and initially set the conditional compilation statement number g(t) = 1 in the t-th hierarchy. In the same hierarchy, the smaller the value of g(t), the earlier the position of the code line corresponding to the conditional compilation statement in the source code.
[0053] Step S82, Based on A n Obtain the g(t)-th conditional compilation statement B in the t-th hierarchy based on the code validity data in tg(t) The overlapping part with the overlapping part AT of the part to be processed tg(t) = [STP tg(t) , ETP tg(t) , STP tg(t) Is the starting position of AT tg(t) ETP tg(t) Is the ending position of AT tg(t) tg(t)
[0054] It should be noted that B tg(t) Is one of the conditional compilation statements corresponding to A n , Through A n In B tg(t) Corresponding B x n Can determine the starting position and ending position corresponding to B tg(t) , And can also determine the compilation status corresponding to B tg(t) , Based on the starting position and ending position corresponding to B tg(t) Can determine the overlapping part of B tg(t) With the overlapping part to be processed.
[0055] Step S83, Based on A n Obtain the compilation status corresponding to B based on the code validity data in tg(t) , If the compilation status corresponding to B tg(t) Is the invalid status, then update the code corresponding to AT tg(t) To the invalid status, update g(x) = g(x) + h(x), where the initial value of g(x) is 1, t < x ≤ T, T is the maximum hierarchy number in A n , And h(x) is the number of conditional compilation statements nested in B tg(t) And belonging to the x-th hierarchy, execute step S86. If the compilation status corresponding to B tg(t) Is the valid status, then execute step S84.
[0056] It should be noted that when the conditional compilation statement is in an invalid state, all the code included in the conditional compilation statement must be in an invalid state. Therefore, the subsequent processing of the conditional compilation statement that has been determined to be in an invalid state can be skipped by updating g(x) = g(x) + h(x), improving the processing efficiency of the validity judgment of the conditional compilation statement code. When the conditional compilation statement is in a valid state, the embedded descendant conditional compilation statements within it are not necessarily in a valid state and need further judgment.
[0057] Step S84, based on U n Judge B tg(t) Whether there are sub-conditional compilation statements. If so, execute step S85; otherwise, execute step S86.
[0058] Step S85, first set t = t + 1, and then return to execute step S82.
[0059] Step S86, if ETP tg(t) = ETP n , then end the processing of the validity of the code in AT n If ETP tg(t) < ETP n , then update [ETP tg(t) , ETP n as the overlapping part to be processed, and execute step S87.
[0060] It should be noted that if ETP tg(t) = ETP n , it means that the validity of all the code in AT n has been completely judged. Therefore, end the processing of the validity of the code in AT n .
[0061] Step S87, if g(t) < f(t), where f(t) is the total number of conditional compilation statements at the t-th level, then set g(t) = g(t) + 1 and return to execute step S82. If g(t) = f(t), then first set t = t - 1, then set g(t) = g(t) + 1, and return to execute step S82.
[0062] It should be noted that through steps S81 - S87, the validity of each overlapping part of the code can be determined, thereby determining the validity of all the conditional compilation statement codes in the continuous visible range to be processed. After determination, the valid and invalid states of all the conditional compilation statement codes in the continuous visible range to be processed can be marked in different display ways on the display interface. For example, different colors can be used for marking. As an embodiment, after the above step S9, it further includes:
[0063] Step S100: marking the valid state and invalid state of all conditional compilation statement codes in the visible range to be processed in different display modes on the display interface.
[0064] As an embodiment, based on the code validity data corresponding to the conditional compilation statement, if the user wants to test the code validity in other situations, the user can directly update at least one code validity information in the code validity data corresponding to the conditional compilation statement, and then re-execute steps S1-S9, so that the code validity corresponding to the conditional compilation statement in the visible range to be processed can be directly displayed without updating the code, which can greatly improve the test efficiency. The method also includes step S10, updating at least one code validity information in the code validity data corresponding to the conditional compilation statement, and re-executing steps S1-S9.
[0065] It should be noted that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0066] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the embodiment of the present invention.
[0067] The embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer instructions are used to execute the method described in the embodiment of the present invention.
[0068] The embodiment of the present invention first divides the visible range to be processed into M continuous visible ranges, obtains the code validity data corresponding to the conditional compilation statement, and then determines the validity of the conditional compilation statement code in each continuous visible range based on the code validity data corresponding to the conditional compilation statement and the overlapping relationship between each continuous visible range and the conditional compilation statement, thereby determining the validity of the code of the visible range to be processed, thereby improving the efficiency and accuracy of judging the validity of the conditional compilation statement code within the visible range.
[0069] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A method for determining the validity of a visible range code, characterized in that: Including: Step S1: Divide the visible range to be processed into M continuous visible ranges {G1, G2, ..., G m ,…,G M },G m is the mth continuous visible range, the value range of m is 1 to M, G1, G2, …, G m ,…,G M Arrange in order of code position; Step S2: Obtain code validity data {A1, A2, ..., A1, A2, ..., A2, A1, A2 ... n ,…,A N }, A n is the code validity data corresponding to the nth group of conditional compilation statements, where n ranges from 1 to N, and N is the total number of code validity data groups corresponding to conditional compilation statements, A1, A2, …, A n ,…,A N Arrange in order of code position, A n Including the code location information and code validity information of the nth top-level conditional compilation statement and the code location information and code validity information of all descendant conditional compilation statements nested in the nth top-level conditional compilation statement; Step S3: Initially set m = 1, initially set the preset pointer to point to A1, and initially set n = 1; Step S4: Get A n The corresponding starting position SCn and ending position ECn; Step S5: If ECn < SV, then execute Step S7. If SCn > EV, then set the current preset pointer to point to A n-1 , execute Step S8. Otherwise, execute Step S6, where SV is the starting position of G m , and EV is the ending position of G m ; Step S6: Get G m With A n The overlap of AT n =[STP n ,ETP n ],STP n AT n Starting position, ETP n AT n The end position of Step S7. If n < N, then set n = n + 1, and set the current preset pointer to point to A n , return to execute Step S4. If n = N and ECn ≤ EV, set the current preset pointer to be empty, and execute Step S8. If n = N and ECn > EV, execute Step S8; Step S8: Based on the overlapping part in {A1, A2, ..., A n ,…,A N } The corresponding code validity information determines G m The validity of the conditional compilation statement code; Step S9: If m < M, then set m = m + 1, and return to execute Step S5. If m = M or the current preset pointer points to null, then end the process.
2. The method according to claim 1, wherein Step S1 includes: Step S11: Set dividing lines at the folding position and the code hiding position in the visible range to be processed to generate M continuous visible ranges {G1, G2, ..., G m ,…,G M }.
3. The method according to claim 1, wherein Step S1 includes: Step S01: Set dividing lines at the folding positions and code hiding positions in the visible range to be processed. If the number of code lines in each obtained continuous visible range is less than or equal to the preset code line threshold, then execute Step S03; otherwise, execute Step S02; Step S02: Evenly divide the continuous visible range with the number of code lines greater than the preset code line threshold into multiple continuous visible ranges, so that the number of code lines in each obtained continuous visible range is less than or equal to the preset code line threshold; Step S03: Generate M continuous visible ranges {G1, G2, ..., G m ,…,G M }.
4. The method according to claim 1, wherein Step S4 includes: Step S41: n The starting position of the top-level conditional compilation statement is determined as A n The corresponding starting position SCn; Step S42: A n The sum of the starting position and the corresponding text length of the top-level conditional compilation statement is determined as A n The corresponding end position ECn.
5. The method according to claim 1, wherein A n = {B1 n ,B2 n ,…,B x n ,…,B f(n) n ,U n }, where B x n A n The code validity data corresponding to the xth conditional compilation statement in , where the value of x ranges from 1 to f(n), and f(n) is A n The total number of conditional compilation statements in U n For B x n The parent-child relationship information between all B x n The corresponding conditional compilation statements are nested to form a top-level conditional compilation statement; B x n = {BF xn ,BL xn ,BV xn }, where BF xn A n The starting position corresponding to the xth conditional compilation statement, BL xn A n The length of the text corresponding to the xth conditional compilation statement, BV xn A n The compilation status corresponding to the xth conditional compilation statement in the compilation state includes two states: valid and invalid.
6. The method according to claim 5, wherein In step S8, all conditional compilation statement codes in the continuous visible range to be processed are set to a valid state by default. n The overlap of AT n implement: Step S81: Initial AT settings n For the overlapped part to be processed, the level identifier t=1 is initially set, and the conditional compilation statement sequence number g(t) in the tth level is initially set to 1. In the same level, the smaller the g(t) value is, the closer the code line corresponding to the conditional compilation statement is in the source code. Step S82: Based on A n Get the g(t)th conditional compilation statement B at level t from the code validity data tg(t) The overlapped part AT with the overlapped part to be processed tg(t) =[STP tg(t) ,ETP tg(t) ],STP tg(t) AT tg(t) Starting position, ETP tg(t) AT tg(t) The end position of Step S83. Obtain the compilation status of B based on the code validity data in A n . If the compilation status of B tg(t) corresponding is the invalid status, then update the code corresponding to A tg(t) to the invalid status, and update g(x) = g(x) + h(x), where the initial value of g(x) is 1, t < x ≤ T, and T is the maximum level serial number in A tg(t) , and h(x) is the number of conditional compilation statements nested in B n and belonging to the x-th level. Then execute step S86. If the compilation status of B tg(t) corresponding is the valid status, then execute step S84; tg(t) Step S84: Based on U n Judgment B tg(t) Whether there is a sub-conditional compilation statement, if yes, execute step S85, otherwise, execute step S86; Step S85: First set t = t + 1, and return to execute Step S82; Step S86: If ETP tg(t) =ETP n , then end AT n In the processing of the validity of the code, if ETP tg(t) <ETP n , then [ETP tg(t) ,ETP n ] is updated to the overlapping part to be processed, and step S87 is executed; Step S87: If g(t) < f(t), where f(t) is the total number of conditional compilation statements at the t-th level, then set g(t) = g(t) + 1, and return to execute Step S82. If g(t) = f(t), then first set t = t - 1, then set g(t) = g(t) + 1, and return to execute Step S82.
7. An electronic device, characterized in that: Including: At least one processor; And a memory communicatively connected to the at least one processor; Wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method according to any one of the preceding claims 1 - 6.
8. A computer-readable storage medium, characterized in that: Stores computer-executable instructions for executing the method according to any one of the preceding claims 1 - 6.
Citation Information
Patent Citations
Code analysis method and device, electronic equipment and readable storage medium
CN115809066A
Test position marking method and device, electronic equipment and storage medium
CN116225889A
Code exception detection method and device, electronic equipment and storage medium
CN117389565A
Code detection processing method and device
CN117762806A
Checking source code validity when code is updated
CN118202330A
Cited By
File continuous visual range determination method, electronic equipment and medium
CN120803597A
