CN117406995A - Auxiliary method for code writing, online code editor, equipment and medium - Google Patents

Auxiliary method for code writing, online code editor, equipment and medium Download PDF

Info

Publication number
CN117406995A
CN117406995A CN202311316638.1A CN202311316638A CN117406995A CN 117406995 A CN117406995 A CN 117406995A CN 202311316638 A CN202311316638 A CN 202311316638A CN 117406995 A CN117406995 A CN 117406995A
Authority
CN
China
Prior art keywords
code
information
grammar
user
corrected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311316638.1A
Other languages
Chinese (zh)
Inventor
杜啸争
任柏熙
金可栋
杨华
胡肖宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Jinxin Software Co Ltd
Original Assignee
Zhongdian Jinxin Software 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 Zhongdian Jinxin Software Co Ltd filed Critical Zhongdian Jinxin Software Co Ltd
Priority to CN202311316638.1A priority Critical patent/CN117406995A/en
Publication of CN117406995A publication Critical patent/CN117406995A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking

Landscapes

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

Abstract

The application provides an auxiliary method for code writing, an online code editor, equipment and a medium, wherein the auxiliary method comprises the following steps: receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code; determining the complement code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information; and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code. By dynamically checking grammar and automatically completing codes input by a user in real time, the time of repeated work and handwriting codes is reduced, and the efficiency and accuracy of code writing are improved.

Description

Auxiliary method for code writing, online code editor, equipment and medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an auxiliary method for code writing, an online code editor, an apparatus, and a medium.
Background
With the rapid development of the internet, the network has become an indispensable assistant for people, great convenience is brought to the work and life of people through the network, various application tools based on the internet are known and used, so that people can program online by means of application software and the like, programming becomes more convenient, rapid and efficient, programming becomes more popular in recent years, and the acceptance of programming by people is higher. Whether large software companies or individual developers need to spend a great deal of time writing codes in project development, the written codes may have errors and hidden dangers, and in the field of the present-day rapid development of software development, more intelligent, personalized and real-time program coding auxiliary tools are increasingly needed. However, while conventional code editors also provide some basic code complement and grammar checking functions, these functions are often limited to static rules and simple pattern matching, resulting in problems of inefficiency and inaccuracy in code writing. Therefore, how to improve the efficiency and accuracy of code writing in an online code editor has become a non-trivial technical problem.
Disclosure of Invention
In view of the foregoing, it is an object of the present application to provide a code writing assistance method, an online code editor, an apparatus and a medium, by dynamically checking grammar and automatically completing codes input by a user in real time, the time of repeated work and handwriting codes is reduced, and the efficiency and accuracy of code writing are improved.
The embodiment of the application provides an auxiliary method for code writing, which is applied to an online code editor and comprises the following steps:
receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code;
determining the complement code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information;
and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code.
In one possible implementation manner, the receiving the first code input by the user, writing grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the wrong grammar content information in the first code, including:
And compiling grammar rules based on standard codes, checking at least one grammar item in bracket statement, variable statement, function call, conditional statement and loop statement included in the first code, and if grammar errors are checked, determining corresponding grammar correction suggestion information according to the error types of the grammar errors so as to enable the grammar content information of the errors in the first code to be corrected based on the grammar correction suggestion information.
In one possible implementation manner, the determining the complement code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the complement code information includes:
analyzing the standard code database and the semantic information of the corrected first code based on a preset code relation analysis mode, determining an analysis result, and predicting code related information of a code structure in the corrected first code based on the analysis result; the code association information comprises association information among code variables, code functions and code attributes;
Based on the code association information, predicting the complement code information of the corrected first code, and automatically completing the corrected first code based on the complement code information;
the preset code analysis mode comprises any one of a dependency relation analysis mode, a data stream analysis mode, an inheritance relation analysis mode, a polymorphism relation analysis mode, a content analysis mode and a static analysis mode.
In one possible implementation manner, after the second code input by the user is continuously received, the auxiliary method further includes, after checking and automatically completing grammar content information of the second code:
generating an object code based on the corrected first code after automatic completion and the second code after automatic completion;
responding to an instruction for typesetting the target codes sent by the user, typesetting the code paragraphs of the target codes based on a standard format and typesetting rules, and displaying the typeset target codes.
In one possible implementation of the present invention,
the auxiliary method further comprises, prior to the receiving the first code entered by the user:
Responding to a vulnerability scanning instruction sent by the user through a vulnerability scanning control, and detecting whether a vulnerability appears;
if yes, providing the vulnerability patch for the user so as to complete vulnerability restoration.
In one possible embodiment, the assistance method further comprises:
responding to the search information input by the user through the search control, and calling an Internet page;
searching the search information on the Internet page, determining target information corresponding to the search information, and sending the target information to the user.
In one possible embodiment, the assistance method further comprises:
responding to the operation of the user aiming at writing program codes when the user performs programming learning through a learning control, and determining exercise condition information of the user based on the writing program codes;
generating learning auxiliary planning information for the user based on the exercise condition information, wherein the learning auxiliary planning information comprises programming knowledge point information aiming at writing abnormal content information and corresponding coding error types and learning suggestion information aiming at each programming knowledge point;
Pushing the learning auxiliary planning information to the user.
The embodiment of the application also provides an online code editor, which comprises:
the grammar checking module is used for receiving a first code input by a user, writing grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information of the errors in the first code;
the completion module is used for determining the completion code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the completion code information;
and the processing module is used for continuously receiving the second code input by the user, checking the grammar content information of the second code and automatically completing the grammar content information.
The embodiment of the application also provides electronic equipment, which comprises: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the method of assisting in the writing of code as described above.
The present embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of assisting in code writing as described above.
The embodiment of the application provides an auxiliary method for code writing, an online code editor, equipment and a medium, wherein the auxiliary method comprises the following steps: receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code; determining the complement code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information; and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code. By dynamically checking grammar and automatically completing codes input by a user in real time, the time of repeated work and handwriting codes is reduced, and the efficiency and accuracy of code writing are improved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an auxiliary method for code writing provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of an online code editor according to an embodiment of the present disclosure;
FIG. 3 is a second schematic diagram of an online code editor according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be appreciated that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
To enable one skilled in the art to utilize the disclosure herein, and with reference to a particular application scenario "writing code," the following implementations are provided and the generic principles defined herein may be applied to other embodiments and applications without departing from the spirit or scope of the disclosure.
First, application scenarios applicable to the present application will be described. The method and the device can be applied to the technical field of computers.
With the rapid development of the internet, the network has become an indispensable assistant for people, great convenience is brought to the work and life of people through the network, various application tools based on the internet are known and used, so that people can program online by means of application software and the like, programming becomes more convenient, rapid and efficient, programming becomes more popular in recent years, and the acceptance of programming by people is higher. Whether large software companies or individual developers need to spend a great deal of time writing codes in project development, the written codes may have errors and hidden dangers, and in the field of the present-day rapid development of software development, more intelligent, personalized and real-time program coding auxiliary tools are increasingly needed. However, while conventional code editors also provide some basic code complement and grammar checking functions, these functions are often limited to static rules and simple pattern matching, resulting in problems of inefficiency and inaccuracy in code writing. Therefore, how to improve the efficiency and accuracy of code writing in an online code editor has become a non-trivial technical problem.
Based on the above, the embodiment of the application provides an auxiliary method for code writing, which realizes the reduction of the time of repeated work and code writing and improves the efficiency and accuracy of code writing by dynamically checking grammar and automatically completing codes input by a user in real time.
Referring to fig. 1, fig. 1 is a flowchart of an auxiliary method for writing codes according to an embodiment of the present application. As shown in fig. 1, an assistance method provided in an embodiment of the present application includes:
s101: and receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code.
In the step, a first code input by a user is received, grammar rules are written according to standard codes, grammar content information of the first code is checked, and if grammar errors are checked, the grammar content information in the first code, which is wrong, is corrected.
Here, the online code editor may receive the user's code input by means of a keyboard, voice recognition, or handwriting input, etc.
The grammar content information comprises variable declarations, function calls, conditional statements, loop statements and other grammar content information.
Through functions such as code analysis and static inspection, potential errors and problems can be detected and prompted, and developers can be helped to find and repair the errors in time. This helps to reduce the code error rate and improve the code quality. The static inspection comprises code inspection, static structure analysis, code quality measurement and the like, and the code inspection comprises code walking inspection, desktop inspection, code inspection and the like. According to the scheme, the grammar content information of the code can be detected and analyzed according to the PMD test tool in the static analysis tool, and the potential problem of the code is determined. Here, the code error information may be checked using other test tools such as FindBugs test tool and Checkstyle test tool in addition to the PMD test tool, which is not limited.
In one possible implementation manner, the receiving the first code input by the user, writing grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the wrong grammar content information in the first code, including:
and compiling grammar rules based on standard codes, checking at least one grammar item in bracket statement, variable statement, function call, conditional statement and loop statement included in the first code, and if grammar errors are checked, determining corresponding grammar correction suggestion information according to the error types of the grammar errors so as to enable the grammar content information of the errors in the first code to be corrected based on the grammar correction suggestion information.
And if the grammar errors are checked, corresponding grammar correction suggestions are determined according to the grammar error types, so that the grammar content information of the errors in the first code is corrected according to the grammar correction suggestions.
Here, the number of grammar errors is displayed on the code writing interface of the online code editor, and the prompt of the number of grammar errors is convenient for the user to know that the user has errors about the understanding of the part of codes, so that the writing and understanding capability of the user on the codes is improved.
The method comprises the steps of carrying out real-time grammar checking on an input code, ensuring the correctness of the code, carrying out progressive scanning on the code, and writing grammar rules according to standard codes of a programming language for verification. Checking other grammar content information such as variable declaration, function call, conditional statement, loop statement, bracket matching, correct use of keywords and reserved words, and the like, checking whether the grammar content information meets the grammar requirement, and if the grammar content information does not meet the grammar requirement, giving corresponding prompt and suggestion to help a user to quickly repair error codes.
In one possible implementation, before the receiving the first code input by the user, the auxiliary method further includes:
a: and responding to a vulnerability scanning instruction sent by the user through a vulnerability scanning control, and detecting whether a vulnerability appears.
Here, whether the online code editor has a vulnerability is detected in response to a vulnerability scanning instruction sent by a user on a vulnerability scanning control of the online code editor.
b: if yes, providing the vulnerability patch for the user so as to complete the vulnerability restoration.
Here, if a vulnerability occurs, a vulnerability patch of the online code editor is provided to the user, so that vulnerability repair of the online code editor is completed.
In the scheme, security holes are scanned and evaluated, and discovered holes are repaired in time. Meanwhile, software updates and patches are timely pushed out to solve the known security problem and improve the security of the online code editor.
S102: and determining the complement code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the complement code information.
In the step, the complementary code information of the corrected first code is determined according to the standard code database and the semantic information of the corrected first code, and the corrected first code is automatically complemented according to the complementary code information.
Here, the standard code database stores a large number of standard codes for implementing different functions.
If no grammar error of the first code is detected, the first code input by the user is automatically complemented directly, for example, after the first code is received, residual complement code information of the first code is predicted according to a standard code database and semantic information of the first code, and the first code is automatically complemented according to the complement code information, so that the first code can completely express a code with a certain function, thereby reducing the workload of the user and accelerating the coding speed.
In one possible implementation manner, the determining the complement code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the complement code information includes:
A: analyzing the standard code database and the semantic information of the corrected first code based on a preset code relation analysis mode, determining an analysis result, and predicting the code association relation of the code structure in the corrected first code based on the analysis result.
The semantic information of the standard code database and the corrected first code is analyzed according to a preset code relation analysis mode, an analysis result is obtained, and code variable, code function and code association information among the corrected first code are predicted according to the analysis result.
The analysis results comprise grammatical analysis results, semantic analysis results and other analysis results.
The code association information comprises association information among code variables, code functions and code attributes;
here, in addition to predicting code variable, code function and code association information between code attributes, other relationships of the code contents may be predicted, and this part will not be described in detail.
The preset code analysis mode comprises any one of a dependency relation analysis mode, a data stream analysis mode, an inheritance relation analysis mode, a polymorphism relation analysis mode, a content analysis mode and a static analysis mode.
Here, the semantic information of the standard code database and the corrected first code may be analyzed by using a plurality of analysis methods.
B: and predicting the complement code information of the corrected first code based on the code association information, and automatically completing the corrected first code based on the complement code information.
Here, according to the code association information, a reference code corresponding to the code association relation is determined in a standard code database, the complement code information of the corrected first code is determined according to the reference code, and automatic complement is performed on the corrected first code according to the complement code information.
According to the scheme, possible code complement options are predicted and provided according to the standard code database and the semantic information of codes, and multiple complement is predicted for multiple times through multiple rounds, so that the input workload of a user is reduced, and the coding speed is increased.
S103: and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code.
In the step, the second code input by the user in real time is continuously received, and the steps of S101 and S102 are continuously and repeatedly executed on the second code, so that dynamic grammar content checking and automatic completion of the code input by the user in real time are realized.
Here, the second code that continues to be received in real time by the user may be received after the first code is automatically complemented, or may be received during the process of complementing the first code, and the portion is not particularly limited as to when the second code is received is determined according to the input of the user.
In one possible implementation manner, after the second code input by the user is continuously received, the auxiliary method further includes, after checking and automatically completing grammar content information of the second code:
(1): and generating an object code based on the corrected first code after automatic completion and the second code after automatic completion.
Here, the complete target code is generated from the first code after the automatic complement after the correction and the second code after the automatic complement.
(2): responding to an instruction for typesetting the target codes sent by the user, typesetting the code paragraphs of the target codes based on a standard format and typesetting rules, and displaying the typeset target codes.
Here, in response to an instruction for typesetting the object code sent by the user, the code paragraphs of the object code are typeset according to the standard format and the typesetting rule, and the typeset object code is displayed.
In the scheme, the codes can be automatically formatted and typeset by defining formatting rules and parsing Abstract Syntax Trees (ASTs) of the codes. The code is then traversed and modified according to rules, adding appropriate indents, spaces, and linefeeds to improve the readability and consistency of the code. To maintain consistent style and readability. This makes the code easier to understand and maintain and reduces the time and effort for the developer to manually format.
In one possible embodiment, the assistance method further comprises:
i: and responding to the search information input by the user through the search control, and calling an Internet page.
Here, the internet page is invoked in response to search information entered by a user on a search control of the online code editor.
Here, the internet page may be a web page.
The search information may be code information, information for inquiring data, etc.
II: searching the search information on the Internet page, determining target information corresponding to the search information, and sending the target information to the user.
Here, searching the search information on the internet page, determining target information corresponding to the search information, and sending the target information to the user.
The searching function is set in the scheme, so that related documents, courses and solutions can be searched on the Internet in real time, and a user can quickly acquire necessary information and help. References to example code, best practices, and solutions are provided to novice developers or those who come into contact with new technology to help them learn and understand programming knowledge faster.
In one possible embodiment, the assistance method further comprises:
i: and responding to the operation of the user aiming at writing the program codes when the user performs programming learning through a learning control, and determining the exercise condition information of the user based on the writing the program codes.
Here, the exercise condition information of the user is determined according to the written program code in response to the operation of the user on the written program code when the user performs programming learning on the learning control of the online code editor.
ii: generating learning auxiliary planning information for the user based on the exercise condition information, wherein the learning auxiliary planning information comprises programming knowledge point information aiming at writing abnormal content information and corresponding coding error types and learning suggestion information aiming at each programming knowledge point; pushing the learning auxiliary planning information to the user.
Here, learning auxiliary planning information is generated for the user according to the exercise condition, wherein the learning auxiliary planning information comprises programming knowledge point information aiming at writing abnormal content information and corresponding coding error types and learning suggestion information aiming at each programming knowledge point; pushing the learning auxiliary planning information to the user.
In one possible embodiment, the assistance method further comprises:
and responding to an instruction of the user for calling the target API interface, providing a corresponding target API interface for the user, so that the user obtains an API document and an example code based on the target API interface, and adjusting the target code according to the API document and the example code.
In this scheme, integration with the version control system is possible, providing support for code commit, branch management, and conflict resolution. This helps the developer better organize and manage the code.
In a specific embodiment, detecting whether a vulnerability appears in the online code editor or not in response to a vulnerability scanning instruction sent by a user on a vulnerability scanning control of the online code editor; if yes, the vulnerability patch of the online code editor is provided for the user, so that vulnerability restoration of the online code editor is completed. And receiving a first code input by a user in real time, checking line by line according to bracket statement, variable statement, function call, conditional statement and loop statement of the first code, and if grammar errors are checked, determining corresponding grammar correction suggestions according to grammar error types so as to correct the grammar content information of the errors in the first code according to the grammar correction suggestions. Determining the complement code information of the corrected first code according to the standard code database and the semantic information of the corrected first code, and automatically complementing the corrected first code according to the complement code information; and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code. Generating an object code according to the corrected first code after automatic completion and the second code after automatic completion; responding to an instruction for typesetting the target codes sent by a user, typesetting the code paragraphs of the target codes according to a standard format and typesetting rules, and displaying the typeset target codes.
The embodiment of the application provides an auxiliary method for code writing, which comprises the following steps: receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code; determining the complement code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information; and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code. By dynamically checking grammar and automatically completing codes input by a user in real time, the time of repeated work and handwriting codes is reduced, and the efficiency and accuracy of code writing are improved.
Referring to fig. 2 and 3, fig. 2 is a schematic structural diagram of an online code editor according to an embodiment of the present application; FIG. 3 is a second schematic diagram of an online code editor according to an embodiment of the present application. As shown in fig. 2, the online code editor 200 includes:
The grammar checking module 210 is configured to receive a first code input by a user, write grammar rules based on standard codes, check grammar content information of the first code, and correct the grammar content information of the first code with errors if grammar errors are checked;
the complementing module 220 is configured to determine complementing code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complement the corrected first code based on the complementing code information;
and the processing module 230 is configured to continue receiving the second code input by the user, and check and automatically complement the grammar content information of the second code.
Further, when the grammar checking module 210 is configured to check the grammar content information of the first code based on the standard code writing grammar rule when the grammar checking module 210 is configured to receive the first code input by the user, and if a grammar error is checked, the grammar checking module 210 is specifically configured to:
and compiling grammar rules based on standard codes, checking at least one grammar item in bracket statement, variable statement, function call, conditional statement and loop statement included in the first code, and if grammar errors are checked, determining corresponding grammar correction suggestion information according to the error types of the grammar errors so as to enable the grammar content information of the errors in the first code to be corrected based on the grammar correction suggestion information.
Further, when the completion module 220 is configured to determine the completion code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, the completion module 220 is specifically configured to:
analyzing the standard code database and the semantic information of the corrected first code based on a preset code relation analysis mode, determining an analysis result, and predicting code related information of a code structure in the corrected first code based on the analysis result; the code association information comprises association information among code variables, code functions and code attributes;
based on the code association information, predicting the complement code information of the corrected first code, and automatically completing the corrected first code based on the complement code information;
the preset code analysis mode comprises any one of a dependency relation analysis mode, a data stream analysis mode, an inheritance relation analysis mode, a polymorphism relation analysis mode, a content analysis mode and a static analysis mode.
Further, as shown in fig. 3, the online code editor 200 further includes a typesetting module 240, where the typesetting module 240 is configured to:
generating an object code based on the corrected first code after automatic completion and the second code after automatic completion;
responding to an instruction for typesetting the target codes sent by the user, typesetting the code paragraphs of the target codes based on a standard format and typesetting rules, and displaying the typeset target codes.
Further, as shown in fig. 3, the online code editor 200 further includes a vulnerability scanning control 250, where the vulnerability scanning control 250 is configured to:
responding to a vulnerability scanning instruction sent by the user through a vulnerability scanning control, and detecting whether a vulnerability appears;
if yes, providing the vulnerability patch for the user so as to complete vulnerability restoration.
Further, as shown in FIG. 3, the online code editor 200 also includes a search control 260, the search control 260 being configured to:
responding to search information input by the user through a search control, and calling an Internet page;
searching the search information on the Internet page, determining target information corresponding to the search information, and sending the target information to the user.
Further, as shown in fig. 3, the online code editor 200 further includes a learning control 270, the learning control 270 being configured to:
responding to the operation of the user aiming at writing program codes when the user performs programming learning through a learning control, and determining exercise condition information of the user based on the writing program codes;
generating learning auxiliary planning information for the user based on the exercise condition information, wherein the learning auxiliary planning information comprises programming knowledge point information aiming at writing abnormal content information and corresponding coding error types and learning suggestion information aiming at each programming knowledge point;
pushing the learning auxiliary planning information to the user.
An online code editor provided in an embodiment of the present application includes: the grammar checking module is used for receiving a first code input by a user, writing grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information of the errors in the first code; the completion module is used for determining the completion code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the completion code information; and the processing module is used for continuously receiving the second code input by the user, checking the grammar content information of the second code and automatically completing the grammar content information. By dynamically checking grammar and automatically completing codes input by a user in real time, the time of repeated work and handwriting codes is reduced, and the efficiency and accuracy of code writing are improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 4, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.
The memory 420 stores machine-readable instructions executable by the processor 410, and when the electronic device 400 is running, the processor 410 communicates with the memory 420 through the bus 430, and when the machine-readable instructions are executed by the processor 410, the steps of the auxiliary method for writing codes in the method embodiment shown in fig. 1 can be executed, and the specific implementation is referred to the method embodiment and will not be described herein.
The embodiment of the present application further provides a computer readable storage medium, where a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the auxiliary method for writing codes in the method embodiment shown in fig. 1 may be executed, and a specific implementation manner may refer to the method embodiment and will not be described herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present application, and are not intended to limit the scope of the present application, but the present application is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, the present application is not limited thereto. Any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or make equivalent substitutions for some of the technical features within the technical scope of the disclosure of the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An auxiliary method of code writing, characterized by being applied to an online code editor, the auxiliary method comprising:
receiving a first code input by a user, compiling grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information in the first code;
determining the complement code information of the corrected first code based on a standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information;
and continuously receiving the second code input by the user, and checking and automatically completing grammar content information of the second code.
2. The auxiliary method according to claim 1, wherein the receiving the first code input by the user, writing grammar rules based on standard codes, checking the grammar content information of the first code, and if a grammar error is checked, correcting the grammar content information of the error in the first code, includes:
and compiling grammar rules based on standard codes, checking at least one grammar item in bracket statement, variable statement, function call, conditional statement and loop statement included in the first code, and if grammar errors are checked, determining corresponding grammar correction suggestion information according to the error types of the grammar errors so as to enable the grammar content information of the errors in the first code to be corrected based on the grammar correction suggestion information.
3. The auxiliary method according to claim 1, wherein determining the complement code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically complementing the corrected first code based on the complement code information, comprises:
analyzing the standard code database and the semantic information of the corrected first code based on a preset code relation analysis mode, determining an analysis result, and predicting code related information of a code structure in the corrected first code based on the analysis result; the code association information comprises association information among code variables, code functions and code attributes;
based on the code association information, predicting the complement code information of the corrected first code, and automatically completing the corrected first code based on the complement code information;
the preset code analysis mode comprises any one of a dependency relation analysis mode, a data stream analysis mode, an inheritance relation analysis mode, a polymorphism relation analysis mode, a content analysis mode and a static analysis mode.
4. The assist method according to claim 1, characterized in that after said continuing to receive the second code entered by the user, checking and automatically complementing the grammar content information of the second code, the assist method further comprises:
generating an object code based on the corrected first code after automatic completion and the second code after automatic completion;
responding to an instruction for typesetting the target codes sent by the user, typesetting the code paragraphs of the target codes based on a standard format and typesetting rules, and displaying the typeset target codes.
5. The assistance method according to claim 1, wherein prior to said receiving the first code entered by the user, the assistance method further comprises:
responding to a vulnerability scanning instruction sent by the user through a vulnerability scanning control, and detecting whether a vulnerability appears;
if yes, providing the vulnerability patch for the user so as to complete vulnerability restoration.
6. The assistance method according to claim 1, characterized in that the assistance method further comprises:
responding to search information input by the user through a search control, and calling an Internet page;
Searching the search information on the Internet page, determining target information corresponding to the search information, and sending the target information to the user.
7. The assistance method according to claim 1, characterized in that the assistance method further comprises:
responding to the operation of the user aiming at writing program codes when the user performs programming learning through a learning control, and determining exercise condition information of the user based on the writing program codes;
generating learning auxiliary planning information for the user based on the exercise condition information, wherein the learning auxiliary planning information comprises programming knowledge point information aiming at writing abnormal content information and corresponding coding error types and learning suggestion information aiming at each programming knowledge point;
pushing the learning auxiliary planning information to the user.
8. An online code editor, the online code editor comprising:
the grammar checking module is used for receiving a first code input by a user, writing grammar rules based on standard codes, checking grammar content information of the first code, and if grammar errors are checked, correcting the grammar content information of the errors in the first code;
The completion module is used for determining the completion code information of the corrected first code based on the standard code database and the corrected semantic information of the first code, and automatically completing the corrected first code based on the completion code information;
and the processing module is used for continuously receiving the second code input by the user, checking the grammar content information of the second code and automatically completing the grammar content information.
9. An electronic device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating via said bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of the method of assisting in the writing of a code according to any of claims 1-7.
10. A computer-readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, performs the steps of the auxiliary method written in code according to any of claims 1-7.
CN202311316638.1A 2023-10-11 2023-10-11 Auxiliary method for code writing, online code editor, equipment and medium Pending CN117406995A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311316638.1A CN117406995A (en) 2023-10-11 2023-10-11 Auxiliary method for code writing, online code editor, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311316638.1A CN117406995A (en) 2023-10-11 2023-10-11 Auxiliary method for code writing, online code editor, equipment and medium

Publications (1)

Publication Number Publication Date
CN117406995A true CN117406995A (en) 2024-01-16

Family

ID=89495466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311316638.1A Pending CN117406995A (en) 2023-10-11 2023-10-11 Auxiliary method for code writing, online code editor, equipment and medium

Country Status (1)

Country Link
CN (1) CN117406995A (en)

Similar Documents

Publication Publication Date Title
CN112016310A (en) Text error correction method, system, device and readable storage medium
US7584093B2 (en) Method and system for generating spelling suggestions
CN111507086B (en) Automatic discovery of translated text locations in localized applications
US10248537B2 (en) Translation bug prediction classifier
CN111507088B (en) Sentence completion method, equipment and readable storage medium
US11010284B1 (en) System for understanding navigational semantics via hypothesis generation and contextual analysis
US10977155B1 (en) System for providing autonomous discovery of field or navigation constraints
US11586839B2 (en) Code completion of method parameters with machine learning
US8364696B2 (en) Efficient incremental parsing of context sensitive programming languages
CN113779062A (en) SQL statement generation method and device, storage medium and electronic equipment
CN111597118A (en) Test case generation method and device, computer equipment and storage medium
CN105378706A (en) Entity extraction feedback
CN110929514B (en) Text collation method, text collation apparatus, computer-readable storage medium, and electronic device
CN114327492A (en) Code translation method, device and equipment
US20060095841A1 (en) Methods and apparatus for document management
CN101727451A (en) Method and device for extracting information
CN116360794A (en) Database language analysis method, device, computer equipment and storage medium
CN113778852B (en) Code analysis method based on regular expression
CN117406995A (en) Auxiliary method for code writing, online code editor, equipment and medium
CN112733517B (en) Method for checking requirement template conformity, electronic equipment and storage medium
CN111796832B (en) Hot patch file generation method, device, equipment and storage medium
KR20230016322A (en) Method and system for extracting fine-grained traceability links between API document comments and test code lines
CN109144564B (en) Modification influence analysis recommendation method and system based on historical modification mode
CN113703753A (en) Method and device for product development and product development system
CN110781072A (en) Code auditing method, device and equipment based on machine learning and storage medium

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