CN112230809B - Method, device and storage medium for selecting computer program codes - Google Patents

Method, device and storage medium for selecting computer program codes Download PDF

Info

Publication number
CN112230809B
CN112230809B CN201910637503.2A CN201910637503A CN112230809B CN 112230809 B CN112230809 B CN 112230809B CN 201910637503 A CN201910637503 A CN 201910637503A CN 112230809 B CN112230809 B CN 112230809B
Authority
CN
China
Prior art keywords
character sequence
target
target character
computer program
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910637503.2A
Other languages
Chinese (zh)
Other versions
CN112230809A (en
Inventor
朱仕达
宿海成
蔡雨利
郭沛然
刘历
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910637503.2A priority Critical patent/CN112230809B/en
Publication of CN112230809A publication Critical patent/CN112230809A/en
Application granted granted Critical
Publication of CN112230809B publication Critical patent/CN112230809B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a method and a device for selecting computer program codes and a storage medium. The terminal can determine the target character sequence from the computer program code according to the action position of the trigger operation received at the display interface of the computer program code, and can directly and automatically select the code segment containing the target character sequence from the computer program code according to the type of the target character sequence. Therefore, the automatic selection of the computer program codes is realized, the selection efficiency is higher, and the writing efficiency of the computer program codes is further improved.

Description

Method, device and storage medium for selecting computer program codes
Technical Field
The present application relates to the field of network technologies, and in particular, to a method and apparatus for selecting computer program codes, and a storage medium.
Background
The computer program code is a source file written by a user (e.g., programmer) in a language supported by the development tool. In writing computer program code, a user may need to perform a selection operation on the computer program code.
In the related art, a terminal may select a computer program code based on a code selection operation triggered by a user. The code selection operation may be an operation in which the user slides a cursor through a mouse or slides a cursor through a touch panel.
However, the selection method of the computer program code in the related art has poor flexibility and low selection efficiency.
Disclosure of Invention
The embodiment of the application provides a method, a device and a storage medium for selecting computer program codes, which can solve the problems of poor flexibility and low selection efficiency of the computer program code selecting method in the related technology. The technical scheme is as follows:
in one aspect, a method for selecting computer program code is provided, the method comprising:
receiving a trigger operation at a display interface of the computer program code;
determining a target character sequence from the computer program code according to the action position of the triggering operation on the display interface;
and selecting a code segment containing the target character sequence from the computer program codes according to the type of the target character sequence.
In another aspect, there is provided an apparatus for selecting computer program code, the apparatus comprising:
the receiving module is used for receiving triggering operation on a display interface of the computer program code;
the determining module is used for determining a target character sequence from the computer program code according to the action position of the triggering operation on the display interface;
and the selecting module is used for selecting a code segment containing the target character sequence from the computer program codes according to the type of the target character sequence.
Optionally, the selecting module is configured to:
based on the grammar structure of the computer program code, a start character sequence and an end character sequence of a code segment containing the target character sequence are determined according to the target character sequence and the target type.
Optionally, the apparatus further includes:
the detection module is used for detecting whether the target character sequence is matched with a character sequence stored in a target character library or not before determining a starting character sequence and an ending character sequence of a code segment containing the target character sequence according to the target character sequence and the target type;
the determining module is further configured to determine that the type of the target character sequence is a target type if the target character sequence is matched with any character sequence in the target character library;
the determining module is further configured to determine that the type of the target character sequence is not a target type if the target character sequence is not matched with any character sequence in the target character library;
the type of the character sequence stored in the target character library is the target type.
Optionally, the determining module is further configured to:
word segmentation is carried out on computer program codes located in the line of the action position, so that a plurality of alternative character sequences are obtained;
and determining the character sequence at the action position as a target character sequence in the plurality of alternative character sequences.
Optionally, the apparatus further includes:
and the adjusting module is used for adjusting the display effect of the code segment containing the target character sequence after selecting the code segment containing the target character sequence from the computer program codes according to the type of the target character sequence.
In yet another aspect, there is provided a terminal including: a processor and a memory, wherein the memory stores at least one instruction, at least one section of program, a code set or an instruction set, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by the processor to implement the method for selecting computer program codes according to the above aspect.
In yet another aspect, a computer readable storage medium is provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by a processor to implement a method of selecting computer program code as described in the above aspect.
The technical scheme provided by the embodiment of the application has the beneficial effects that at least the following steps are included:
in summary, the embodiments of the present application provide a method, an apparatus and a storage medium for selecting computer program codes. The terminal can determine the target character sequence from the computer program code according to the action position of the trigger operation received at the display interface of the computer program code, and can directly and automatically select the code segment containing the target character sequence from the computer program code according to the type of the target character sequence. Therefore, the automatic selection of the computer program codes is realized, the selection efficiency is higher, and the writing efficiency of the computer program codes is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an implementation environment of a selection method of computer program codes according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for selecting computer program code according to an embodiment of the present application;
FIG. 3 is a flowchart of another method for selecting computer program code according to an embodiment of the present application;
FIG. 4 is a schematic diagram of computer program code displayed on a terminal display interface according to an embodiment of the present application;
FIG. 5 is a schematic diagram of computer program code displayed on another terminal display interface according to an embodiment of the present application;
FIG. 6 is a schematic diagram of computer program code displayed on a display interface of yet another terminal according to an embodiment of the present application;
FIG. 7 is a block diagram of a selection device of computer program code according to an embodiment of the present application;
FIG. 8 is a block diagram of another selection apparatus of computer program code provided by an embodiment of the present application;
fig. 9 is a block diagram of a terminal according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an implementation environment related to a method for selecting computer program codes according to an embodiment of the present application. As shown in fig. 1, the implementation environment may include: the terminal 110 may be a computer, a notebook computer, a smart phone, or the like, and fig. 1 illustrates the terminal 110 as a computer.
In an embodiment of the present application, a development tool for writing computer program code may be installed in the terminal 110, and a user may write computer program code using the development tool.
Fig. 2 is a flowchart of a method for selecting computer program codes according to an embodiment of the present application, and the method may be applied to the terminal 110 shown in fig. 1. As shown in fig. 2, the method may include:
step 201, a triggering operation is received at a display interface of the computer program code.
The triggering operation may be a click operation, which may be, for example, a single click operation or a double click operation. When a user needs to select a certain code or a certain character sequence in the computer program codes displayed on the display interface, the user can move the cursor to the area where the certain code or the certain character sequence is located through the mouse or the touch panel, and then click operation is performed at the position where the cursor is located. Correspondingly, the terminal can receive the triggering operation on the display interface of the computer program code.
In embodiments of the present application, the character sequence may include one or more characters, which may be letters, numbers, punctuation marks, operational symbols, special characters, chinese characters, connectors, or the like.
Step 202, determining a target character sequence from the computer program code according to the action position of the trigger operation on the display interface.
In the embodiment of the application, after the terminal receives the trigger operation, the action position of the trigger operation in the display interface can be determined first, for example, the coordinates of the trigger operation in the display interface can be determined. The terminal may then determine the character sequence closest to the action position as the target character sequence.
Step 203, selecting a code segment containing the target character sequence from the computer program codes according to the type of the target character sequence.
Wherein the type of the target character sequence may be a keyword, an operator, or other types. Keywords may refer to: identifiers that are predefined and of special significance in the programming language supported by the development tool. The operators may refer to: punctuation marks predefined and specific to a particular application in programming languages supported by the development tool.
In the embodiment of the application, the terminal can pre-store a code segment selection algorithm corresponding to different types of character sequences, and after determining the type of the target character sequence, the terminal can select the code segment containing the target character sequence from the computer program codes by adopting the code segment selection algorithm corresponding to the type of the target character sequence.
Alternatively, the code segment may include other character sequences than the target character sequence, or the code segment may include only the target character sequence.
In summary, the embodiments of the present application provide a method for selecting computer program codes. The terminal can determine the target character sequence from the computer program code according to the action position of the trigger operation received at the display interface of the computer program code, and can directly and automatically select the code segment containing the target character sequence from the computer program code according to the type of the target character sequence. Therefore, the automatic selection of the computer program codes is realized, the selection efficiency is higher, and the writing efficiency of the computer program codes is further improved.
Fig. 3 is a flowchart of another method for selecting computer program codes according to an embodiment of the present application, which can be applied to the terminal 110 shown in fig. 1. As shown in fig. 3, the method may include:
step 301, a triggering operation is received at a display interface of the computer program code.
The triggering operation may be a clicking operation, for example, a single-click operation or a double-click operation. When a user needs to select a certain code or a certain character sequence in the computer program codes displayed on the display interface, the user can move the cursor to the area where the certain code or the certain character sequence is located through the mouse or the touch panel, and then click operation is performed at the position where the cursor is located. Correspondingly, the terminal can receive the triggering operation on the display interface of the computer program code.
For example, assuming that the trigger operation is a double click operation, referring to fig. 4, a row of computer program code "var qq=1 is displayed in the display interface of the terminal; when the user performs a double click operation on the region where the character sequence "qq" in the row of computer program codes is located through the mouse, the terminal can receive a trigger operation in the display interface.
Step 302, word segmentation is performed on computer program codes located in a row where the trigger operation is located on the action position of the display interface, so as to obtain a plurality of alternative character sequences.
In the embodiment of the application, after receiving the trigger operation, the terminal can determine the action position of the trigger operation in the display interface, for example, can determine the coordinates of the trigger operation in the display interface. Then, the terminal can adopt a pre-stored word segmentation algorithm to segment the computer program code of the line where the action position is located, so as to obtain a plurality of alternative character sequences. The word segmentation may refer to the segmentation of a character sequence of an acquired section of computer program code. Alternatively, the terminal may word the computer program code with punctuation marks and spaces as separators.
For example, assume that the computer program code of the trigger operation acquired by the terminal on the line where the trigger operation acts on the display interface is "var qq=1; "then referring to fig. 4, the terminal applies a word segmentation algorithm to the computer program code" var qq=1; after the word segmentation, var, qq, "=", "1" and "; "five alternative character sequences in total".
By word segmentation of the computer program code of the line where the action position is located, a plurality of alternative character sequences are obtained, so that the terminal can reliably determine the character sequence which the user expects to select according to the action position.
Step 303, determining a character sequence at an action position as a target character sequence in a plurality of alternative character sequences.
In the embodiment of the application, after the terminal performs word segmentation on the computer program code to obtain a plurality of alternative character sequences, the character sequence closest to the action position can be directly determined as the target character sequence, namely, the character sequence expected to be selected by the user.
For example, referring to fig. 4 and 5, assuming that the action position of the trigger operation acquired by the terminal in the display interface is the area where the alternative character sequence "qq" is located, the terminal may determine the alternative character sequence "qq" as the target character sequence.
Step 304, detecting whether the target character sequence is matched with the character sequence stored in the target character library.
In the embodiment of the application, a target character library can be stored in the terminal in advance, a plurality of character sequences can be stored in the target character library, and the type of each character sequence can be a target type. And the target types may include: one or more of keywords and operators. That is, the target character library may have at least one keyword and at least one operator stored therein.
Wherein, the keyword refers to: identifiers that are predefined and of special significance in the programming language supported by the development tool. For example: if. while and char, etc.; the operators refer to: punctuation marks predefined and specific to a particular application in programming languages supported by the development tool. For example, {, }, + and-and the like.
Because in the embodiment of the application, the terminal can store the code segment selection algorithm corresponding to different types of character sequences, namely, for different types of target character sequences, different code segment selection algorithms can be adopted to select the code segment containing the target character sequence. For example, for a target character sequence of which the type is a target type, the code segment selected by the terminal using the code segment selection algorithm corresponding to the type may include the target character sequence and other character sequences. For a target character sequence with a type which is not the target type, the code segment selected by the terminal by adopting the code segment selection algorithm corresponding to the type can only contain the target character sequence. Therefore, after the terminal determines the target character sequence, the type of the target character sequence needs to be further determined.
Optionally, after determining the target character sequence, the terminal may compare the target character sequence with the character sequences stored in the target character library one by one, so as to detect whether the target character sequence is matched with the character sequences stored in the target character library. If the terminal detects that the target character sequence matches (i.e., is identical to) any character sequence in the target character library, the following step 305 may be continued. If the terminal detects that the target character sequence does not match any character sequence in the target character library, the following step 306 may be continued.
For example, assuming that the character sequence stored in the target character library includes "if, while, {, }, char, final, case, <, >, [, & and ]", the terminal determines that the target character sequence is "if", the terminal may detect that the target character sequence "if" is identical to the character sequence "if" in the target character library, and at this time, the terminal may continue to perform step 305 described below.
Step 305, determining the type of the target character sequence as the target type.
Because the types of the character sequences stored in the target character library are all target types, if the terminal detects that the target character sequence is matched with any character sequence in the target characters, the type of the target character sequence can be determined to be the target type. At this point, the terminal may continue to perform step 307 described below.
For example, assuming that the target character sequence determined by the terminal is "if" and the target character sequence "if" is identical to the character sequence "if" in the target character library, the terminal can determine that the type of the target character sequence "if" is the target type. At this point, the terminal may continue to perform step 307.
It should be noted that, the terminal may store the corresponding character sequences in the target character library in the "keyword" list and the "operator" list, respectively. For example. The terminal may store "if, while, char, final and case" etc. in the "keyword" list, and "{, }, <, >, [, & and ]" etc. in the "operator" list. Furthermore, after determining that the type of the target character sequence is the target type, the terminal may further determine the specific type of the target character sequence, that is, determine whether the type of the target character sequence is a keyword or an operator.
Step 306, determining that the type of the target character sequence is not the target type.
Similarly, if the terminal detects that the target character sequence is not matched with any character sequence in the target characters, the type of the target character sequence can be determined to be not the target type. At this point, the terminal may continue to perform step 308 described below.
For example, assuming that the target character sequence determined by the terminal is "qq", and the target character sequence "qq" is different from the character sequences in the target character library, the terminal may determine that the type of the target character sequence "qq" is not the target type. At this point, the terminal may continue to step 308.
Step 307, determining a start character sequence and an end character sequence of the code segment containing the target character sequence according to the target character sequence and the target type, and selecting the code segment according to the start character sequence and the end character sequence.
Because the code segment selected by the code segment selection algorithm corresponding to the target type comprises the target character sequence and other character sequences, namely the code segment corresponding to the target character sequence with the type being the target type is a code segment (also called a code block), when the terminal determines that the type of the target character sequence is the target type, the initial character sequence and the end character sequence can be determined according to the target character sequence and the target type of the target character sequence based on the grammar structure of the computer program code. The terminal may then select the start character sequence, the end character sequence, and the characters between the start character sequence and the end character sequence as code segments.
For example, assuming that the target character sequence determined by the terminal is "if" and the type of the target character sequence is determined to be the target type "keyword", referring to fig. 6, the terminal may determine that the start character sequence of the code segment containing the "if" is "if" and the end character sequence is "jj" according to the target character sequence "if" and the type "keyword" thereof based on the syntax structure of the computer program code. Further, the terminal may select a code segment "if (value 1=true) { control log (" test ") }" including the start character sequence "if" and the end character sequence "}" and located between the start character sequence "if" and the end character sequence "}" as a code segment according to the start character sequence "if" and the end character sequence "}".
Alternatively, the terminal may have stored therein an abstract syntax tree (abstract syntax tree, AST) of the computer program code, which is an abstract representation of the syntax structure of the computer program code, which may represent the syntax structure of the computer program code in a tree-like form, each node on the tree representing a structure in the computer program code. Accordingly, after determining that the type of the target character sequence is the target type, the terminal may determine a start character sequence and an end character sequence of the code segment including the target character sequence according to the target character sequence and the target type using AST.
Step 308, selecting a target character sequence.
When the terminal determines that the type of the target character sequence is not the target type, the target character sequence may be directly selected according to the word segmentation result in step 302, that is, the target character sequence is directly selected as the code segment.
For example, assuming that the target character sequence determined by the terminal is "qq", and it is determined that the target character sequence "qq" is not the target type, the terminal may determine that the character sequence desired to be selected by the user is the target character sequence "qq", and correspondingly, the terminal may select the target character sequence "qq" as the code segment.
It should be noted that, in the embodiment of the present application, the terminal selecting the code segment may refer to that the terminal sets the code segment to an editable state. I.e. the code segment is determined as the editing object of the subsequently received editing operation.
Step 309, adjusting the display effect of the code segment containing the target character sequence.
In the embodiment of the application, in order to facilitate a user to check the code segment which needs to be selected in a large amount of computer program codes, after the terminal selects the code segment containing the target character sequence, the display effect of the code segment can be adjusted. Optionally, the method for adjusting the display effect may include: highlighting, bolding, adjusting fonts, font sizes, font colors, and increasing underlining.
For example, referring to fig. 5, the terminal may bold-display its selected code segment "qq" in the display interface. For another example, referring to fig. 6, the terminal may highlight its selected code segment "if (value1=true) { control. Log (" test ") }) in the display interface.
It should be noted that the sequence of the steps of the selection method of the computer program code provided in the embodiment of the present application may be appropriately adjusted, for example, the steps 302 and 309 may be deleted according to circumstances. That is, the terminal may determine, directly according to the determined action position of the trigger operation on the display interface, one or more character sequences closest to the action position as the target character sequence. And the terminal may not adjust the display effect of the selected code segment. Any method that can be easily conceived by those skilled in the art within the technical scope of the present disclosure should be covered in the protection scope of the present disclosure, and thus will not be repeated.
In summary, the embodiments of the present application provide a method for selecting computer program codes. The terminal can determine the target character sequence from the computer program code according to the action position of the trigger operation received at the display interface of the computer program code, and can directly and automatically select the code segment containing the target character sequence from the computer program code according to the type of the target character sequence. Therefore, the automatic selection of the computer program codes is realized, the selection efficiency is higher, and the writing efficiency of the computer program codes is further improved.
Fig. 7 is a block diagram of a selecting device of computer program codes according to an embodiment of the present application, where the device may be the terminal 110 in the implementation environment shown in fig. 1, or the device may be disposed on the terminal 110. As shown in fig. 7, the apparatus 70 may include:
the receiving module 701 is configured to receive a triggering operation at a display interface of the computer program code.
A determining module 702 is configured to determine a target character sequence from the computer program code according to the action position of the trigger operation on the display interface.
A selection module 703, configured to select a code segment containing the target character sequence from the computer program code according to the type of the target character sequence.
Optionally, the selecting module 703 may be configured to:
if the type of the target character sequence is the target type, determining a start character sequence and an end character sequence of a code segment containing the target character sequence according to the target character sequence and the target type, and selecting the code segment according to the start character sequence and the end character sequence.
And if the type of the target character sequence is not the target type, selecting the target character sequence.
Wherein the target type includes one or more of keywords and operators.
Optionally, the selecting module 703 may be further configured to: based on the grammar structure of the computer program code, a start character sequence and an end character sequence of a code segment containing the target character sequence are determined according to the target character sequence and the target type.
Alternatively, fig. 8 is a block diagram of another selecting device for computer program codes according to an embodiment of the present application. As shown in fig. 8, the apparatus 70 may include:
a detecting module 704, configured to detect whether the target character sequence matches a character sequence stored in the target character library before determining a start character sequence and an end character sequence of a code segment including the target character sequence according to the target character sequence and the target type.
Accordingly, the determination module 702 may also be configured to: if the target character sequence is matched with any character sequence in the target character library, determining the type of the target character sequence as the target type. If the target character sequence is not matched with any character sequence in the target character library, determining that the type of the target character sequence is not the target type.
The type of the character sequence stored in the target character library is a target type.
Optionally, the determining module 702 may be further configured to: the computer program code located at the line where the active position is located is segmented to obtain a plurality of alternative character sequences. And determining a character sequence located at the action position as a target character sequence from among the plurality of alternative character sequences.
Optionally, as shown in fig. 8, the apparatus 70 may further include:
the adjustment module 705 is configured to adjust a display effect of a code segment including the target character sequence after selecting the code segment including the target character sequence from the computer program code according to the type of the target character sequence.
In summary, the embodiments of the present application provide a device for selecting computer program codes. The device can determine the target character sequence from the computer program code according to the action position of the trigger operation received at the display interface of the computer program code, and can directly and automatically select the code segment containing the target character sequence from the computer program code according to the type of the target character sequence. Therefore, the automatic selection of the computer program codes is realized, the selection efficiency is higher, and the writing efficiency of the computer program codes is further improved.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 9 shows a block diagram of a computer program code selecting apparatus 900 according to an exemplary embodiment of the present application. The device 900 may be: a terminal such as a smart phone, a tablet computer, a notebook computer or a desktop computer. Device 900 may also be referred to by other names of user devices, portable terminals, laptop terminals, desktop terminals, and the like. Alternatively, device 900 may be a server.
In general, the apparatus 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, a 9-core processor, and the like. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 901 may also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 901 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 902 is used to store at least one instruction for execution by processor 901 to implement a method of selecting computer program code provided by an embodiment of the present application.
In some embodiments, the apparatus 900 may further optionally include: a peripheral interface 903, and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by a bus or signal line. The individual peripheral devices may be connected to the peripheral device interface 903 via buses, signal lines, or circuit boards. Specifically, the peripheral device includes: at least one of radio frequency circuitry 904, a touch display 905, a camera 906, audio circuitry 907, and a power source 909.
The peripheral interface 903 may be used to connect at least one peripheral device associated with an I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, either or both of the processor 901, the memory 902, and the peripheral interface 903 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 904 is configured to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuit 904 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity ) networks. In some embodiments, the radio frequency circuit 904 may also include NFC (Near Field Communication ) related circuits, which the present application is not limited to.
The display 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 905 is a touch display, the display 905 also has the ability to capture touch signals at or above the surface of the display 905. The touch signal may be input as a control signal to the processor 901 for processing. At this time, the display 905 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 905 may be one, disposed on the front panel of the device 900; in other embodiments, the display 905 may be at least two, respectively disposed on different surfaces of the device 900 or in a folded design; in other embodiments, the display 905 may be a flexible display disposed on a curved surface or a folded surface of the device 900. Even more, the display 905 may be arranged in an irregular pattern other than rectangular, i.e., a shaped screen. The display 905 may be made of LCD (Liquid Crystal Display ), OLED (Organic Light-Emitting Diode) or other materials.
The power supply 909 is used to power the various components in the device 900. The power supply 909 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 909 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. Rechargeable batteries may also be used to support fast charge technology. Those skilled in the art will appreciate that the structure shown in fig. 9 is not limiting of the apparatus 900 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
The embodiment of the application also provides a computer readable storage medium, which can store at least one instruction, at least one section of program, a code set or an instruction set, wherein the at least one instruction, the at least one section of program, the code set or the instruction set is loaded by a processor and executed to realize the selection method of the computer program code shown in fig. 2 or 3.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the present application is not intended to limit the application, but rather, the application is to be construed as limited to the appended claims.

Claims (8)

1. A method of selecting computer program code, the method comprising:
receiving a trigger operation at a display interface of the computer program code;
determining a target character sequence from the computer program code according to the action position of the triggering operation on the display interface;
selecting a code segment containing the target character sequence from the computer program code according to the type of the target character sequence; wherein selecting a code segment containing the target character sequence from the computer program code according to the type of the target character sequence comprises: if the type of the target character sequence is a target type, determining a start character sequence and an end character sequence of a code segment containing the target character sequence according to the target character sequence and the target type, and selecting the code segment according to the start character sequence and the end character sequence; if the type of the target character sequence is not the target type, selecting the target character sequence; wherein the target type includes one or more of keywords and operators.
2. The method of claim 1, wherein determining a start character sequence and an end character sequence of a code segment containing the target character sequence based on the target character sequence and the target type comprises:
based on the grammar structure of the computer program code, a start character sequence and an end character sequence of a code segment containing the target character sequence are determined according to the target character sequence and the target type.
3. The method of claim 1, wherein prior to determining a start character sequence and an end character sequence of a code segment containing the target character sequence based on the target character sequence and the target type, the method further comprises:
detecting whether the target character sequence is matched with a character sequence stored in a target character library;
if the target character sequence is matched with any character sequence in the target character library, determining the type of the target character sequence as a target type;
if the target character sequence is not matched with any character sequence in the target character library, determining that the type of the target character sequence is not a target type;
the type of the character sequence stored in the target character library is the target type.
4. A method according to any one of claims 1 to 3, wherein said determining a target character sequence from said computer program code in accordance with the position of action of said trigger operation on said display interface comprises:
word segmentation is carried out on computer program codes located in the line of the action position, so that a plurality of alternative character sequences are obtained;
and determining the character sequence at the action position as a target character sequence in the plurality of alternative character sequences.
5. A method according to any one of claims 1 to 3, characterized in that after selecting a code segment containing the target character sequence from the computer program code according to the type of the target character sequence, the method further comprises:
and adjusting the display effect of the code segment containing the target character sequence.
6. A selection device of computer program code, the device comprising:
the receiving module is used for receiving triggering operation on a display interface of the computer program code;
the determining module is used for determining a target character sequence from the computer program code according to the action position of the triggering operation on the display interface;
a selecting module, configured to select a code segment including the target character sequence from the computer program code according to the type of the target character sequence; the selecting module is specifically configured to: if the type of the target character sequence is a target type, determining a start character sequence and an end character sequence of a code segment containing the target character sequence according to the target character sequence and the target type, and selecting the code segment according to the start character sequence and the end character sequence; if the type of the target character sequence is not the target type, selecting the target character sequence; wherein the target type includes one or more of keywords and operators.
7. A terminal, the terminal comprising: a processor and a memory, wherein at least one instruction, at least one program, a code set, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the code set, or the set of instructions are loaded and executed by the processor to implement the method of selecting computer program code according to any one of claims 1 to 5.
8. A computer readable storage medium having stored therein at least one instruction, at least one program, code set, or instruction set, the at least one instruction, the at least one program, the code set, or instruction set being loaded and executed by a processor to implement a method of selecting computer program code according to any one of claims 1 to 5.
CN201910637503.2A 2019-07-15 2019-07-15 Method, device and storage medium for selecting computer program codes Active CN112230809B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910637503.2A CN112230809B (en) 2019-07-15 2019-07-15 Method, device and storage medium for selecting computer program codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910637503.2A CN112230809B (en) 2019-07-15 2019-07-15 Method, device and storage medium for selecting computer program codes

Publications (2)

Publication Number Publication Date
CN112230809A CN112230809A (en) 2021-01-15
CN112230809B true CN112230809B (en) 2023-08-18

Family

ID=74111579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910637503.2A Active CN112230809B (en) 2019-07-15 2019-07-15 Method, device and storage medium for selecting computer program codes

Country Status (1)

Country Link
CN (1) CN112230809B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000023055A (en) * 1998-06-22 2000-01-21 Samsung Electron Co Ltd Digital television receiver having adaptive filter circuit for suppression of same ntsc channel interference
CN1573693A (en) * 2003-06-18 2005-02-02 微软公司 System and method for creating, managing and using code segments
CN105094780A (en) * 2014-05-14 2015-11-25 国际商业机器公司 Information correlation method and device
CN105808263A (en) * 2016-03-11 2016-07-27 浪潮通信信息系统有限公司 Method for visually constructing front-end system by code snippets when a system is operated
CN105930332A (en) * 2016-01-13 2016-09-07 平安科技(深圳)有限公司 Code release and query method and terminal
US9806741B1 (en) * 2016-10-10 2017-10-31 International Business Machines Corporation Character conversion
CN108062290A (en) * 2017-12-14 2018-05-22 北京三快在线科技有限公司 Message-text processing method and processing device, electronic equipment, storage medium
CN109783737A (en) * 2019-01-18 2019-05-21 深圳壹账通智能科技有限公司 Information retrieval method, device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9182947B2 (en) * 2013-06-06 2015-11-10 International Business Machines Corporation Program source code navigation

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000023055A (en) * 1998-06-22 2000-01-21 Samsung Electron Co Ltd Digital television receiver having adaptive filter circuit for suppression of same ntsc channel interference
CN1573693A (en) * 2003-06-18 2005-02-02 微软公司 System and method for creating, managing and using code segments
CN105094780A (en) * 2014-05-14 2015-11-25 国际商业机器公司 Information correlation method and device
CN105930332A (en) * 2016-01-13 2016-09-07 平安科技(深圳)有限公司 Code release and query method and terminal
CN105808263A (en) * 2016-03-11 2016-07-27 浪潮通信信息系统有限公司 Method for visually constructing front-end system by code snippets when a system is operated
US9806741B1 (en) * 2016-10-10 2017-10-31 International Business Machines Corporation Character conversion
CN108062290A (en) * 2017-12-14 2018-05-22 北京三快在线科技有限公司 Message-text processing method and processing device, electronic equipment, storage medium
CN109783737A (en) * 2019-01-18 2019-05-21 深圳壹账通智能科技有限公司 Information retrieval method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112230809A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
US11086663B2 (en) Preloading application using active window stack
CN108647055B (en) Application program preloading method and device, storage medium and terminal
CN108958830B (en) Application program starting method and device, storage medium and terminal
EP2940572A1 (en) Method and electronic device for managing display objects
US10884611B2 (en) Method and apparatus for controlling touch screen of terminal, and terminal
CN103092604A (en) Application program classification method and device
CN102968338A (en) Method and device for classifying application program of electronic equipment and electronic equipment
US10402222B2 (en) Task migration method and apparatus
CN106502703B (en) Function calling method and device
CN108920070B (en) Screen splitting method and device based on special-shaped display screen, storage medium and mobile terminal
CN106681817B (en) Terminal control method and terminal
CN101772761A (en) Electronic device interface control system
CN106980447B (en) Information processing method and device and terminal
CN105721015A (en) Dual-channel mobile terminal capable of multiplexing Flash ROM
CN113392660A (en) Page translation method and device, electronic equipment and storage medium
CN112230809B (en) Method, device and storage medium for selecting computer program codes
CN112069015B (en) Instruction execution method and device for instruction simulator, terminal equipment and storage medium
CN114237743B (en) Interface loading method and device, electronic equipment and storage medium
CN115687146A (en) BIOS (basic input output System) test method and device, computer equipment and storage medium
CN112578961B (en) Application identifier display method and device
KR20180109401A (en) Method for correcting typographical error and mobile terminal using the same
CN114721785B (en) Configuration method, device, equipment and storage medium of software application library of virtual machine
EP4280041A1 (en) Translation method and electronic device
CN108733814B (en) Search engine preloading method and device, storage medium and terminal
US20150128082A1 (en) Multi-language input method and multi-language input apparatus using the same

Legal Events

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