JP6022815B2 - Source code difference extraction method and system using parsing - Google Patents

Source code difference extraction method and system using parsing Download PDF

Info

Publication number
JP6022815B2
JP6022815B2 JP2012131974A JP2012131974A JP6022815B2 JP 6022815 B2 JP6022815 B2 JP 6022815B2 JP 2012131974 A JP2012131974 A JP 2012131974A JP 2012131974 A JP2012131974 A JP 2012131974A JP 6022815 B2 JP6022815 B2 JP 6022815B2
Authority
JP
Japan
Prior art keywords
change
data
difference
source code
analysis
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
JP2012131974A
Other languages
Japanese (ja)
Other versions
JP2013257639A (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.)
NTT Data Corp
Original Assignee
NTT Data Corp
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 NTT Data Corp filed Critical NTT Data Corp
Priority to JP2012131974A priority Critical patent/JP6022815B2/en
Publication of JP2013257639A publication Critical patent/JP2013257639A/en
Application granted granted Critical
Publication of JP6022815B2 publication Critical patent/JP6022815B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

本発明は、構文解析を用いたソースコードの差分抽出方法およびシステムに関する。   The present invention relates to a source code difference extraction method and system using syntax analysis.

コンピュータを動作させるために、Java(登録商標)、C言語、C++などのプログラミング言語を用いて、人間(場合によってはコンピュータ自身)により記述されるコンピュータプログラム(ソースコード)は、一度記述された後であっても、再度記述が見直され、場合によっては変更されることが少なくない。例えば、当該ソースコードにより動作するアプリケーションやシステムなどの開発段階、またはリリース後などに、機能(仕様)変更が発生したり、バグの発生による修正作業が発生したりする場合があるためである。ソースコードを変更した場合、変更したソースコードの品質を確保するために、変更前後のソースコードを比較し、変更内容が正しくソースコードに反映されているかの確認作業を行う。この確認作業は、ソースコードを変更した開発者自身による自己レビューのみならず、他の開発者や開発者以外の者(例えば、当該ソースコードにより動作するアプリケーションやシステムなどの利用者、すなわち顧客など)による第三者レビューによって実施される。このレビューは、変更内容が正しくソースコードに反映されているか確認するために、変更前後のソースコードを視認して変更箇所を抽出し、これを比較、検討することにより行われる。しかしながら、アプリケーションやシステムの規模によるが、ソースコードが数千、数万行に及ぶ場合や、また変更箇所も数百、数千箇所に及ぶ場合もあるため、変更前後のソースコードから変更箇所を抽出する作業(差分抽出作業)には膨大な工数を要している。また、ソースコードの記述は、類似箇所が多数あったり、同一内容を繰り返し記述していたりする場合などがあり、変更箇所の抽出に一層工数を要したり、場合によっては、変更前後のソースコードの誤った箇所同士を変更前後として対応付けてしまう場合もある。さらに、特に開発者以外の者は、ソースコードを読めない場合が多いいため、ソースコードから差分を抽出し、設計書(例えば詳細設計書など)を修正する作業がさらに必要となる。この際の設計書の修正箇所は、ソースコードの修正箇所にほぼ等しく、またソースコードと設計書の修正箇所の対応付けを誤る場合もある。このように、ソースコードの差分抽出により、工数増大や品質低下の問題が発生している。   In order to operate a computer, a computer program (source code) written by a human (or the computer itself in some cases) using a programming language such as Java (registered trademark), C language, or C ++ is written once. Even so, the description is reviewed again and is often changed in some cases. This is because, for example, a function (specification) change may occur or a correction work may occur due to the occurrence of a bug at the development stage of an application or system that operates with the source code, or after release. When the source code is changed, in order to ensure the quality of the changed source code, the source code before and after the change is compared and a check operation is performed to check whether the changed content is correctly reflected in the source code. This confirmation work includes not only self-review by the developer who changed the source code but also other developers and non-developers (for example, users of applications and systems that operate with the source code, that is, customers, etc.) ) Conducted by a third party review. This review is performed by visually checking the source code before and after the change, extracting the changed part, and comparing and examining it in order to check whether the change is correctly reflected in the source code. However, depending on the size of the application or system, the source code may be in the thousands or tens of thousands of lines, and there may be changes in the hundreds or thousands of places. The extraction work (difference extraction work) requires a huge amount of man-hours. In addition, the source code description may have many similar parts or the same content may be described repeatedly, which may require more man-hours to extract the changed part, and in some cases, the source code before and after the change. In some cases, incorrect locations are associated before and after the change. Furthermore, since a person other than the developer often cannot read the source code, it is necessary to further extract a difference from the source code and correct a design document (for example, a detailed design document). In this case, the correction part of the design document is almost equal to the correction part of the source code, and the correspondence between the source code and the correction part of the design document may be wrong. As described above, the extraction of the source code difference causes problems such as an increase in man-hours and a decrease in quality.

上記問題を解決するために、従来より、多くの差分抽出ツール(またはシステム)が利用されてきた。これらは、変更前後のソースコードの互いの1行づつを比較し、同一行を特定し、特定されなかった行を変更箇所として抽出するものである。差分抽出ツールの一態様では、例えば、GUI(グラフィカルユーザインターフェース)を介して、比較する変更前後のソースコードを選択し、GUI上の左右に変更前後のソースを表示し、変更があった行をハイライト表示したり、削除・追加された行はソースコードの一方を空行で表示するなどし、変更箇所をユーザに示す。別の態様では、結果をファイルに出力するものもある。いずれにせよ、変更前後のソースコードの行の対応付け(例えば変更前後のソースコードを横並びにして同じ高さの行を同一行としたり、変更前後の行番号を示す、など)と、変更内容が示される。   In order to solve the above problems, many difference extraction tools (or systems) have been used conventionally. These compare each line of the source code before and after the change, identify the same line, and extract the unidentified line as a changed part. In one aspect of the difference extraction tool, for example, the source code before and after the change to be compared is selected via a GUI (graphical user interface), the source before and after the change is displayed on the left and right on the GUI, and the line where the change has occurred is displayed. Highlighted lines, deleted / added lines, etc. are displayed as blank lines on one side of the source code, etc., and the changes are shown to the user. In another aspect, the result is output to a file. In any case, the source code lines before and after the change (for example, the source code before and after the change is lined up so that the same height line is the same line, the line number before and after the change is shown), and the change contents Is shown.

特開平6−318152号公報JP-A-6-318152

しかしながら、従来の差分抽出ツールは、必ずしもユーザにとって十分な情報が示されているとは言えない。例えば、行の一部の変更(例えば、IF文の複数パラメータの1つのパラメータの変更)や単にインデントの上げ下げ(以下、「字上げ」、「字下げ」という)を行った場合であっても、その行に変更があったことしか判断できず、また変更前後の行の対応関係を正確に検知することもできない。すなわち、ユーザは結局、示された情報から、「2行目から7行目が変更行として示されているが、その中の5行は変更後のソースコードでは空行のため、5行が削除され、残りの1行は、変更前のソースコードの6行目と一致するため、6行目だけが2行目として残っている」、または「1行目のIF文が変更箇所として示されているが、1つ目のパラメータ部分は同一で、2つ目のパラメータ部分は異なり、3つ目の・・・」などと、比較、検討を行う必要がある。この作業を変更箇所のほぼ全てに対して行うことになり、場合によっては誤認や見落としが発生する場合もある。このように、従来の差分抽出ツールは、本来解決すべき、ソースコードの差分抽出による工数増大や品質低下の問題を十分に解決できているとは言い難い。   However, it cannot be said that the conventional difference extraction tool necessarily shows sufficient information for the user. For example, even when a part of a line is changed (for example, one parameter of an IF statement is changed) or simply indented (hereinafter referred to as “indentation” or “indentation”). , It can only determine that the line has been changed, and it cannot accurately detect the correspondence between the lines before and after the change. That is, after all, from the information shown, the user says “2nd to 7th lines are shown as changed lines, but 5 lines are blank lines in the changed source code. Deleted and the remaining 1 line matches the 6th line of the source code before the change, so only the 6th line remains as the 2nd line "or" IF statement on the 1st line indicates the changed part However, the first parameter part is the same, the second parameter part is different, and the third parameter part needs to be compared and examined. This operation is performed for almost all of the changed portions, and in some cases, misidentification or oversight may occur. As described above, it is difficult to say that the conventional difference extraction tool can sufficiently solve the problems of man-hour increase and quality degradation due to source code difference extraction.

また、特許文献1に記載の発明など、設計書などドキュメントの保守を目的として、ソースコード(プログラム)中のコメントや制御文を構文解析し、コンピュータによりドキュメントを作成する方法が開示されているが、作成されるドキュメントは修正後のソースコードによるもののみであり、ソースコードの差分抽出をし、変更箇所を明確に示すようなドキュメントを生成するものではない。   In addition, the invention described in Patent Document 1, for example, discloses a method of generating a document by a computer by parsing comments and control statements in a source code (program) for the purpose of maintaining a document such as a design document. The document to be created is only based on the modified source code, and does not extract a difference of the source code and generate a document that clearly shows the changed part.

本発明は、このような問題に鑑みてなされたもので、その目的とするところは、構文解析を用いたソースコードの差分抽出方法およびシステムを提供することにある。   The present invention has been made in view of such problems, and an object of the present invention is to provide a source code difference extraction method and system using syntax analysis.

本発明は、このような目的を達成するために、
変更前後のソースコードを構文解析し差分を抽出するコンピュータ装置であって、前記コンピュータ装置は、
変更前後のソースコードに含まれる予約語に基づき構文解析を行い、前記変更前後のソースコードの各々に対して、前記予約語をノードとする抽象構文木データを生成する構文解析手段と、
前記生成した抽象構文木データの木構造データの深さに基づきネスト情報の解析を行い、前記変更前後のソースコードの各々に対して、ネスト構文要素データを生成するネスト情報解析手段と、
前記生成したネスト構文要素データの各々の比較に基づき、差分抽出データを生成する差分抽出手段であって、前記差分抽出データは、前記変更前後のソースコードにおいて変更があったことを示す第1の差分識別子を含む、差分抽出手段と、
少なくとも一致判別ルールと条件追加・削除抽出ルールとに基づき前記生成した差分抽出データを解析し、差分解析データを生成する差分解析手段であって、前記差分解析データは、変更前後の変更がどのような変更かを示す第2の差分識別子、ならびに変更前後の予約語と、非予約語と、ネスト数と、行番号とを変更前後の行単位で対応して有し、前記第2の差分識別子は、前記第1の差分識別子と比較して、少なくとも、変更前後の変更内容が条件文の条件の追加、または削除であることを多く示すことができ、前記差分解析データを生成することは、
前記一致判別ルールに従った解析として、前記生成した差分抽出データのうちの、変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の行として一致するか否かを判定すること
を含む、差分解析手段と
を備えたことを特徴とする。
In order to achieve such an object, the present invention
A computer device that parses the source code before and after the change and extracts a difference, the computer device comprising:
Syntactic analysis based on reserved words included in the source code before and after the change, and for each of the source codes before and after the change, syntax analysis means for generating abstract syntax tree data having the reserved word as a node;
Nest information analysis means for analyzing nest information based on the tree structure data depth of the generated abstract syntax tree data, and generating nested syntax element data for each of the source code before and after the change,
Difference extraction means for generating difference extraction data based on the comparison of each of the generated nested syntax element data , wherein the difference extraction data indicates a change in the source code before and after the change. A difference extraction means including a difference identifier ;
A difference analysis means for analyzing the generated difference extraction data based on at least a match determination rule and a condition addition / deletion extraction rule and generating difference analysis data, wherein the difference analysis data is changed before and after the change. A second difference identifier indicating whether the change is made, a reserved word before and after the change, a non-reserved word, a nest number, and a row number corresponding to each other before and after the change, and the second difference identifier Compared with the first difference identifier, at least, it is possible to indicate that the change content before and after the change is addition or deletion of a condition of a conditional statement, and generating the difference analysis data
As an analysis according to the match determination rule, in the generated difference extraction data, the lines before and after the change are matched according to the degree of matching between the reserved words and the non-reserved words corresponding to the lines before and after the change. Difference analysis means including determining whether or not.

また、前段落に記載の発明における、前記差分解析データを生成することは、
前記条件追加・削除抽出ルールに従った解析として、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の変更が条件文の条件の追加、または削除であるか否かを判定すること
をさらに含むことを特徴とする。
In the invention described in the preceding paragraph, generating the difference analysis data
As an analysis according to the condition addition / deletion extraction rule, each of the reserved word and the non-reserved word corresponding to the line before and after the change when it is determined as a line before and after the change in the analysis according to the match determination rule The method further includes determining whether or not the change before and after the change is an addition or deletion of a condition in the conditional sentence according to the degree of coincidence between them.

さらに、前段落に記載の発明における、前記差分解析データを生成することは、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行のネスト数を比較して、字上げまたは字下げが発生しているか否かを判定することをさらに含み、前記第2の差分識別子は、前記第1の差分識別子と比較して、変更前後の変更内容が字上げまたは字下げであることをさらに示すことができることを特徴とする。   Further, in the invention described in the preceding paragraph, the generation of the difference analysis data may be performed by setting the nesting number of the lines before and after the change when it is determined that the lines before and after the change match in the analysis according to the match determination rule. In comparison, it further includes determining whether or not indentation or indentation has occurred, and the second difference identifier is compared with the first difference identifier, and the content of the change before and after the change is character. It is characterized in that it can be further shown to be up or down.

また、前段落に記載の発明における、前記コンピュータ装置は、前記生成した差分解析データと前記生成した変更前のソースコードに対するネスト構文要素データを設計書用文言に変換し、設計書データを生成する設計書生成手段であって、前記設計書データは、変更前後の変更内容を、変更前後の行単位で対応して有する、設計書生成手段をさらに備えたことを特徴とする。   In the invention described in the preceding paragraph, the computer apparatus converts the generated differential analysis data and the generated nested syntax element data for the source code before the change into a design document word, and generates design document data. Design document generation means, characterized in that the design document data further comprises design document generation means having the change contents before and after the change corresponding to each line before and after the change.

さらに、前段落に記載の発明における、前記設計書データは、前記変更前後の変更内容を修飾表示するためのデータと、前記変更前後の変更内容をハイライト表示するためのデータとをさらに有することを特徴とする。   Further, in the invention described in the preceding paragraph, the design document data further includes data for displaying the modified content before and after the modification, and data for highlighting the modified content before and after the change. It is characterized by.

以上説明したように、本発明によれば、変更前後のコンピュータプログラム(ソースコード)に対して構文解析、差分抽出を行い、さらに差分の詳細を解析することにより、変更箇所を明確に示すようなドキュメントを生成することが可能となる。   As described above, according to the present invention, the computer program (source code) before and after the change is subjected to syntax analysis and difference extraction, and the details of the difference are further analyzed to clearly indicate the changed portion. Documents can be generated.

本発明の一実施形態に係るコンピュータの構成を示すブロック図である。It is a block diagram which shows the structure of the computer which concerns on one Embodiment of this invention. 本発明の一実施形態に係るソースコード差分抽出・解析処理フローを示す図である。It is a figure which shows the source code difference extraction and analysis processing flow which concerns on one Embodiment of this invention. 本発明の一実施形態に係る旧ソースコードを示す図である。It is a figure which shows the old source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る新ソースコードを示す図である。It is a figure which shows the new source code which concerns on one Embodiment of this invention. 従来の差分抽出ツールによる新旧ソースコードの差分抽出例を示す図である。It is a figure which shows the example of the difference extraction of the old and new source code by the conventional difference extraction tool. 理想的な、新旧ソースコードの差分抽出例を示す図である。It is a figure which shows the example of an ideal difference extraction of the old and new source code. 本発明の一実施形態に係る旧ソースコードの抽象構文木を示す図である。It is a figure which shows the abstract syntax tree of the old source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る新ソースコードの抽象構文木を示す図である。It is a figure which shows the abstract syntax tree of the new source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る旧ソースコードの抽象構文木データを示す図である。It is a figure which shows the abstract syntax tree data of the old source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る新ソースコードの抽象構文木データを示す図である。It is a figure which shows the abstract syntax tree data of the new source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る旧ソースコードのネスト・構文要素TSVを示す図である。It is a figure which shows the nesting and syntax element TSV of the old source code based on one Embodiment of this invention. 本発明の一実施形態に係る新ソースコードのネスト・構文要素TSVを示す図である。It is a figure which shows the nesting and syntax element TSV of the new source code which concerns on one Embodiment of this invention. 本発明の一実施形態に係る差分抽出結果を示す図である。It is a figure which shows the difference extraction result which concerns on one Embodiment of this invention. 本発明の一実施形態に係る差分解析処理フローを示す図である。It is a figure which shows the difference analysis processing flow which concerns on one Embodiment of this invention. 本発明の一実施形態に係る一致判別ルールに従った判定処理フローを示す図である。It is a figure which shows the determination processing flow according to the matching determination rule which concerns on one Embodiment of this invention. 本発明の一実施形態に係る条件追加・削除抽出ルールに従った解析処理フローを示す図である。It is a figure which shows the analysis processing flow according to the condition addition / deletion extraction rule which concerns on one Embodiment of this invention. 本発明の一実施形態に係る字上げ・字下げ抽出ルールに従った解析処理フローを示す図である。It is a figure which shows the analysis processing flow according to the indentation / indentation extraction rule which concerns on one Embodiment of this invention. 本発明の一実施形態に係る差分解析結果を示す図である。It is a figure which shows the difference analysis result which concerns on one Embodiment of this invention. 本発明の一実施形態に係る設計書生成処理フローを示す図である。It is a figure which shows the design document production | generation process flow which concerns on one Embodiment of this invention. 本発明の一実施形態に係る予約語−日本語変換テーブルを示す図である。It is a figure which shows the reserved word-Japanese conversion table which concerns on one Embodiment of this invention. 本発明の一実施形態に係る設計書生成結果を示す図である。It is a figure which shows the design document production | generation result which concerns on one Embodiment of this invention.

以下、図面を参照しながら本発明の実施形態について詳細に説明する。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

図1は、本発明の一実施形態に係るコンピュータの構成を示すブロック図である。コンピュータ100は、処理装置101に、システムバス102を介してメモリ103、入力装置104、出力装置105、通信制御装置106および不揮発性記憶媒体(ROMやHDDなど)で構成される記憶装置107が接続された構成を有する。記憶装置107は、差分抽出システム110を格納しており、差分抽出システム110は、各機能を奏するためのソフトウェアプログラムを格納するプログラム格納領域と、随時取得するデータや処理結果としてのデータなどを格納するデータ格納領域とを備えている。以下に説明するプログラム格納領域の各手段は、実際は独立したソフトウェアプログラム、そのルーチンやコンポーネントなどであり、処理装置101によって記憶装置107から呼び出されメモリ103のワークエリアに展開されて、データベースなどを適宜参照しながら順次実行されることで、各機能を奏するものである。   FIG. 1 is a block diagram showing a configuration of a computer according to an embodiment of the present invention. The computer 100 is connected to the processing device 101 via a system bus 102 with a memory 103, an input device 104, an output device 105, a communication control device 106, and a storage device 107 including a nonvolatile storage medium (ROM, HDD, etc.). It has the structure made. The storage device 107 stores a difference extraction system 110. The difference extraction system 110 stores a program storage area for storing a software program for performing each function, data acquired at any time, data as a processing result, and the like. Data storage area. Each means of the program storage area described below is actually an independent software program, its routines, components, etc., which are called from the storage device 107 by the processing device 101 and expanded in the work area of the memory 103 to appropriately store a database or the like. Each function is performed by being executed sequentially with reference to the reference.

プログラム格納領域に格納されているソフトウェアプログラムは、本発明に関連するものだけを列挙すると、構文解析手段111、ネスト情報解析手段112、差分抽出手段113、差分解析手段114、および設計書生成手段115を備えている。   If only software programs related to the present invention are listed in the program storage area, syntax analysis means 111, nest information analysis means 112, difference extraction means 113, difference analysis means 114, and design document generation means 115 are listed. It has.

データ格納領域は、本発明に関連するものだけを列挙すると、ソースコードデータ記憶部121、抽象構文木データ記憶部122、ネスト・構文要素TSVデータ記憶部123、差分抽出データ記憶部124、差分解析データ記憶部125、設計書データ記憶部126、構文解析データ記憶部127、および構文変換データ記憶部128を備える。何れも、記憶装置107内に確保された一定の記憶領域である。   If only data storage areas related to the present invention are listed, a source code data storage unit 121, an abstract syntax tree data storage unit 122, a nested / syntax element TSV data storage unit 123, a difference extraction data storage unit 124, a difference analysis A data storage unit 125, a design document data storage unit 126, a syntax analysis data storage unit 127, and a syntax conversion data storage unit 128 are provided. Each is a certain storage area secured in the storage device 107.

図2は、本発明の一実施形態に係るソースコード差分抽出・解析処理フローを示す図である。本フローは、大きく分けて5つのステップからなる。各ステップの詳細な説明は、図を用いて後述する。ここでは、処理の大まかな流れを説明する。   FIG. 2 is a diagram showing a source code difference extraction / analysis processing flow according to an embodiment of the present invention. This flow is roughly divided into five steps. Detailed description of each step will be described later with reference to the drawings. Here, a rough flow of processing will be described.

まず、ステップ201にて、構文解析手段111が、ソースコードデータ記憶部121に記憶された変更前のソースコード(以下、「旧ソースコード」という)と、変更後のソースコード(以下、「新ソースコード」という)を取得する。続いて、構文解析手段111は、取得した新旧ソースコードの各々に対し、構文解析データ記憶部127に記憶された構文解析データ(ソースコード中の定型語、例えば、IF文の“IF”や“ELSE”などの予約語)に基づき、構文解析を行い、抽象構文木というデータ構造を生成する。抽象構文木は、その詳細は後述するが、予約語をノードとし、各予約語に対応する非予約語(例えばIF文の条件部分)を各々の葉として持つ木構造である。抽象構文木は、新旧ソースコードの各々で生成され、抽象構文木データ記憶部122に記憶される。   First, in step 201, the syntax analysis unit 111 uses the source code before change (hereinafter referred to as “old source code”) stored in the source code data storage unit 121 and the source code after change (hereinafter referred to as “new source code”). Source code). Subsequently, the syntax analysis unit 111 performs, for each of the acquired old and new source codes, the syntax analysis data stored in the syntax analysis data storage unit 127 (fixed words in the source code, for example, “IF” and “ Based on a reserved word such as “ELSE”), and a data structure called an abstract syntax tree is generated. Although the details of the abstract syntax tree will be described later, the abstract syntax tree has a tree structure having a reserved word as a node and a non-reserved word (for example, a conditional part of an IF sentence) corresponding to each reserved word as a leaf. An abstract syntax tree is generated for each of the old and new source codes and stored in the abstract syntax tree data storage unit 122.

次に、ステップ202にて、ネスト情報解析手段112が、生成された新旧ソースコードの抽象構文木を、抽象構文木データ記憶部122から取得し、各予約語についてルートからの深さをカウントすることでネスト情報を解析し、ネスト数を算出する。続いて、ネスト情報解析手段112は、各予約語単位に、対応する非予約語と算出したネスト数を1レコードとし、各レコードをソースコードの行番号順に持ったネスト・構文要素TSV(Tab Separated Values/タブ区切り)データを生成する。ネスト・構文要素TSVは、新旧ソースコードの各々で生成され、ネスト・構文要素TSVデータ記憶部123に記憶される。   Next, in step 202, the nest information analyzing unit 112 acquires the generated abstract syntax trees of the old and new source codes from the abstract syntax tree data storage unit 122, and counts the depth from the root for each reserved word. The nesting information is analyzed and the number of nestings is calculated. Subsequently, the nest information analyzing unit 112 sets, for each reserved word unit, a corresponding non-reserved word and the calculated number of nests as one record, and a nested syntax element TSV (Tab Separated) having each record in the order of the line number of the source code. (Values / tab delimited) data is generated. The nest / syntax element TSV is generated in each of the new and old source codes and stored in the nest / syntax element TSV data storage unit 123.

次に、ステップ203にて、差分抽出手段113が、生成された新旧ソースコードのネスト・構文要素TSVデータを、ネスト・構文要素TSVデータ記憶部123から取得し、各レコードを比較することで、差分を抽出する。ここでの差分抽出は、従来技術と同等のものであり、新旧ソースコードにおける変更箇所(変更行)を特定するのみである。すなわち、ソースコードの削除、追加、変更を差分として抽出することはできるが、変更についてはどのような変更がされたのか、および行中の全体についての変更なのか、または一部なのかを示すことはできない。抽出された差分データは、差分抽出データ記憶部124に記憶される。   Next, in step 203, the difference extraction means 113 obtains the nest / syntax element TSV data of the generated old and new source code from the nest / syntax element TSV data storage unit 123, and compares the records. Extract the difference. The difference extraction here is equivalent to the prior art, and only specifies the changed part (changed line) in the old and new source code. That is, you can extract source code deletions, additions, and changes as differences, but what changes have been made and whether they are changes or partial changes in the line It is not possible. The extracted difference data is stored in the difference extraction data storage unit 124.

次に、ステップ204にて、差分解析手段114が、生成された差分抽出データを、差分抽出データ記憶部124から取得し、所定のルールに基づいて、各予約語、および非予約語を比較することで、各変更がどのような変更(行追加・削除、条件の追加・削除、など)なのかを解析する。また、各ネスト数を比較することで、字上げ・字下げによる変更の有無を解析する。解析結果は、差分解析データ記憶部125に記憶される。   Next, in step 204, the difference analysis means 114 acquires the generated difference extraction data from the difference extraction data storage unit 124, and compares each reserved word and non-reserved word based on a predetermined rule. Thus, it is analyzed what kind of change (addition / deletion of rows, addition / deletion of conditions, etc.) of each change. In addition, by comparing each nest number, the presence or absence of a change due to indentation / indentation is analyzed. The analysis result is stored in the difference analysis data storage unit 125.

次に、ステップ205にて、設計書生成手段115が、旧ネスト・構文要素TSVデータをベースに、差分解析データと、構文変換データ記憶部128に記憶された構文変換データ(例えば、予約語と日本語の変換テーブル)とに基づき、設計書を生成する。   Next, in step 205, the design document generation means 115 is based on the old nesting / syntax element TSV data, the difference analysis data, and the syntax conversion data stored in the syntax conversion data storage unit 128 (for example, reserved words and A design document is generated based on the Japanese conversion table.

次に、図3‐13、および18のソースコードやデータ、図14−17のフローチャートを参照して、一実施形態に係るソースコードの差分抽出および解析処理を詳細に説明する。なお、図3‐13、および18のソースコードやデータは、以下の説明において、流れに沿って説明できるよう、一貫性を持たせてある。   Next, the source code difference extraction and analysis processing according to an embodiment will be described in detail with reference to the source code and data of FIGS. 3-13 and 18 and the flowchart of FIGS. 14-17. The source code and data in FIGS. 3-13 and 18 are made consistent so that they can be explained along the flow in the following description.

図3は、本発明の一実施形態に係る旧ソースコードを示す図であり、図4は、本発明の一実施形態に係る新ソースコードを示す図である。301および401はソースコードの行数を表し、302および402にはソースコードを示す。また、図3の旧ソースコードに対し、変更を行ったものが図4の新ソースコードである。より具体的には、図3の旧ソースコードから、「QTY = 0 AND ID != 4」なる条件分岐を削除し、どのような場合であっても「MOVE 'Success' TO RTN-CDE」(旧ソースコードの6行目)を実行するように変更したものが、図4の新ソースコードである。この際、IF文により2文字分ネストされていた旧ソースコード6行目は、2文字分字上げされる。   FIG. 3 is a diagram illustrating an old source code according to an embodiment of the present invention, and FIG. 4 is a diagram illustrating a new source code according to an embodiment of the present invention. 301 and 401 indicate the number of lines of the source code, and 302 and 402 indicate the source code. The new source code shown in FIG. 4 is obtained by changing the old source code shown in FIG. More specifically, the conditional branch “QTY = 0 AND ID! = 4” is deleted from the old source code in FIG. 3 and “MOVE 'Success' TO RTN-CDE” ( The new source code in FIG. 4 is changed to execute the sixth source line of the old source code. At this time, the sixth line of the old source code that is nested by two characters by the IF statement is raised by two characters.

まず、当該新旧ソースコードに対し、従来の差分抽出ツールを用いて差分抽出を行った結果例を図5に示す。501はソースコードの行数を表し、502が旧ソースコード、503が新ソースコードである。504には、新旧ソースコードの各行を対比した結果、どのような変更が行われたかを示している。504を参照すると、旧ソースコードの2行目〜7行目に対し何らかの変更が行われ、新ソースコードの2行目になったことがわかる。しかしながら、図6に示す理想的な差分抽出結果例のように、旧ソースコードの2行目〜5行目、および7行目が削除され、6行目が字上げされたことが示されることが望ましい。   First, FIG. 5 shows an example of a result obtained by extracting a difference between the new and old source codes using a conventional difference extraction tool. Reference numeral 501 represents the number of lines of the source code, 502 is the old source code, and 503 is the new source code. Reference numeral 504 denotes what changes have been made as a result of comparing the lines of the old and new source code. Referring to 504, it can be seen that some changes have been made to the second to seventh lines of the old source code, and the second line of the new source code has been reached. However, as in the example of the ideal difference extraction result shown in FIG. 6, it is shown that the second to fifth and seventh lines of the old source code are deleted and the sixth line is indented. Is desirable.

次に、一実施形態に係るソースコードの差分抽出および解析処理のうち、第1ステップ(図2のステップ201)となる新旧ソースコードの構文解析および抽象構文木の生成について説明する。   Next, syntactic analysis of old and new source code and generation of an abstract syntax tree, which are the first step (step 201 in FIG. 2), of the source code difference extraction and analysis processing according to an embodiment will be described.

第1ステップでは、図3および図4に示す新旧ソースコードの各々をインプットとし、構文解析を行い、新旧ソースコード各々の抽象構文木データをアウトプットとして生成する。当該構文解析は、構文解析データ(図示せず。具体的には、ソースコード中の定型語、例えば、IF文の“IF”や“ELSE”などの予約語と、特定のルールを有するデータである。特定のルールとは、例えば、IF文は“IF”から始まり、“IF”の後には“THEN”が続き、場合によって“ELSE”が続く、など予約語におけるルールである。)に基づいて行われる。より具体的には、ソースコードの各行に対し、構文解析データを用いて、各行が何らかの予約語を含む構文なのか、単なるコメントか、などの解析を行い、各行と行間の関係を抽象構文木というデータ構造に変換する。この際、単なるコメントは排除され、ソースコードの実行に関係する予約語および非予約語が変換される。   In the first step, each of the old and new source codes shown in FIGS. 3 and 4 is used as an input, syntax analysis is performed, and abstract syntax tree data of each of the old and new source codes is generated as an output. The parsing is performed by parsing data (not shown. Specifically, it is a fixed word in the source code, for example, a reserved word such as “IF” or “ELSE” in the IF sentence, and data having a specific rule. The specific rule is, for example, a rule in a reserved word such that an IF sentence starts with “IF”, followed by “THEN” followed by “ELSE” in some cases. Done. More specifically, for each line of the source code, the parsing data is used to analyze whether each line includes a reserved word or a simple comment, and the relationship between each line and the abstract syntax tree is analyzed. Convert to the data structure At this time, simple comments are excluded, and reserved words and non-reserved words related to the execution of the source code are converted.

図7は、本発明の一実施形態に係る旧ソースコードの抽象構文木を示す図であり、図8は、本発明の一実施形態に係る新ソースコードの抽象構文木を示す図である。当該抽象構文木は、1つのルート(図7および8では「 / 」で示す。)を基点として、各予約語をノードとし、各予約語に対応する非予約語(例えばIF文の条件部分。図7および8にでは、破線ブロックで示す。)を各々の葉として持つ木構造である。また、各ノードは行番号を持ち、各予約語のノードはネストする度にノードを深くして示される(換言すると、ノードの深さを以って、ネストレベルを表現している)。ここで、非予約語のノードを破線で示しているのは、抽象構文木上で非予約語は予約語の付随的な情報であることを意味するためである。したがって、非予約語のノードは枝分かれして示され、付随する予約語と同一のネストレベルに属していることを示している。   FIG. 7 is a diagram illustrating an abstract syntax tree of an old source code according to an embodiment of the present invention, and FIG. 8 is a diagram illustrating an abstract syntax tree of a new source code according to an embodiment of the present invention. The abstract syntax tree is based on one root (indicated by “/” in FIGS. 7 and 8), and each reserved word is a node, and a non-reserved word (for example, a conditional part of an IF sentence) corresponding to each reserved word. 7 and 8, which are indicated by broken line blocks). Each node has a row number, and each reserved word node is shown deeper each time it is nested (in other words, the nesting level is expressed by the depth of the node). Here, the non-reserved word node is indicated by a broken line because it means that the non-reserved word is ancillary information of the reserved word on the abstract syntax tree. Therefore, nodes of non-reserved words are shown in a branched manner, indicating that they belong to the same nesting level as the associated reserved words.

図7および8に新旧ソースコードの抽象構文木を示したが、これらはあくまでもデータ構造のイメージを示すもので、実際にソースコードから変換(生成)されるデータは、図9および10に示されるものである。図9は、本発明の一実施形態に係る旧ソースコードの抽象構文木データを示す図であり、図10は、本発明の一実施形態に係る新ソースコードの抽象構文木データを示す図である。抽象構文木データ901および1001は予約語毎のレコードであり、ユニークな整数値である「ID」と、従属する予約語のレコードのIDを示す「親ID」と、従属する親IDが同一の場合の他レコードとの関係(順序)を示す「兄弟間の順序」と、「予約語」、「行番号」、予約語に付随する非予約語を示す「非予約語のリスト」とからなる。ここで、抽象構文木データ上、「兄弟間の順序」を持たずに、単に「ID」を連番にして「ID」が若いレコードの方が兄弟間の順序が先である、または「行番号」が若い方が先の順序である、などと判断することもできる。また、「非予約語のリスト」は、予約語に対して付随する非予約語が複数存在する場合は、例えば、カンマなどのデリミタを用いて1つのデータ項目として持つことになるが、非予約語毎に1レコードとすることもできる。この場合、予約語と非予約語がユニークキーになり、さらに非予約語の順序を示すデータを持つことになることは、当業者であれば理解できよう。   FIGS. 7 and 8 show the abstract syntax trees of the old and new source code. These are merely images of the data structure, and the data actually converted (generated) from the source code is shown in FIGS. Is. FIG. 9 is a diagram illustrating abstract syntax tree data of an old source code according to an embodiment of the present invention, and FIG. 10 is a diagram illustrating abstract syntax tree data of a new source code according to an embodiment of the present invention. is there. The abstract syntax tree data 901 and 1001 are records for each reserved word, and “ID” that is a unique integer value, “parent ID” that indicates the ID of the record of the subordinate reserved word, and the subordinate parent ID are the same. "Order between siblings" indicating the relationship (order) with other records, "reserved words", "line numbers", and "list of non-reserved words" indicating non-reserved words attached to reserved words . Here, on the abstract syntax tree data, the “order between siblings” is not included, but the “ID” is a sequential number, and the younger “ID” has the first order between siblings or “row” It can also be determined that the younger number is the first order. The “non-reserved word list” has a single data item using a delimiter such as a comma when there are a plurality of non-reserved words attached to the reserved word. One record can be set for each word. In this case, those skilled in the art will understand that reserved words and non-reserved words become unique keys and further have data indicating the order of non-reserved words.

続いて、一実施形態に係るソースコードの差分抽出および解析処理のうち、第2ステップ(図2のステップ202)となる新旧ソースコードのネスト情報の解析およびネスト・構文要素TSVの生成について説明する。   Subsequently, analysis of the nesting information of the old and new source code and generation of the nesting / syntax element TSV, which are the second step (step 202 in FIG. 2), of the source code difference extraction and analysis processing according to the embodiment will be described. .

第2ステップでは、第1ステップで生成した新旧ソースコードの抽象構文木データ901および1001の各々をインプットとし、ネスト情報の解析を行い、新旧ソースコード各々のネスト・構文要素TSVをアウトプットとして生成する。当該ネスト情報の解析は、各予約語についてルートからの深さをカウントする。   In the second step, each of the abstract syntax tree data 901 and 1001 of the old and new source code generated in the first step is used as input, the nesting information is analyzed, and the nested / syntax element TSV of each of the old and new source code is generated as output. To do. In the analysis of the nesting information, the depth from the root is counted for each reserved word.

図11は、本発明の一実施形態に係る旧ソースコードのネスト・構文要素TSVを示す図であり、図12は、本発明の一実施形態に係る新ソースコードのネスト・構文要素TSVを示す図である。ネスト・構文要素TSV1101および1201は予約語毎のレコードであり、予約語毎に算出したネスト数を示す「ネスト数」と、「予約語」と、予約語に付随する1番目の非予約語を示す「非予約語1」と、予約語に付随する2番目の非予約語を示す「非予約語2」と、「行番号」からなる。ここで、「ネスト数」は、上述の通り、ルートからの深さをカウントすることにより算出されるが、図11および12の例では、ネストした数を示すために、カウント数から1減算した数値を示している。また、図11および12の例では、「非予約語1」および「非予約語2」の2つの非予約語を示しているが、3番目以降の非予約語が必要な場合は、「非予約語3」以降のデータ項目を持つことを理解されたい。また、「非予約語1」および「非予約語2」は、上述した抽象構文木データ901および1001の例のように、デリミタを用いて1つのデータ項目として持つこともできる。さらに図11における予約語「THEN」および「ELSE」のレコードに見られるように、「非予約語1」には、例えば、対応する予約語「IF」のレコードの「非予約語1」の値を持つこともできる。なお、ネスト・構文要素TSV(Tab Separated Values/タブ区切り)は、TSVとしているが、必ずしもタブ区切り形式である必要はない。   FIG. 11 is a diagram illustrating a nesting / syntax element TSV of an old source code according to an embodiment of the present invention, and FIG. 12 illustrates a nesting / syntax element TSV of a new source code according to an embodiment of the present invention. FIG. Nesting / syntax elements TSV1101 and 1201 are records for each reserved word, and the “nesting number” indicating the number of nests calculated for each reserved word, “reserved word”, and the first non-reserved word attached to the reserved word “Non-reserved word 1”, “non-reserved word 2” indicating the second non-reserved word attached to the reserved word, and “line number”. Here, as described above, the “nesting number” is calculated by counting the depth from the root, but in the examples of FIGS. 11 and 12, 1 is subtracted from the counting number to indicate the number of nesting. Numerical values are shown. 11 and 12 show two non-reserved words “non-reserved word 1” and “non-reserved word 2”. However, when the third and subsequent non-reserved words are required, It should be understood that it has a data item after “reserved word 3”. In addition, “non-reserved word 1” and “non-reserved word 2” can also be held as one data item using a delimiter, as in the example of the abstract syntax tree data 901 and 1001 described above. Furthermore, as can be seen in the records of reserved words “THEN” and “ELSE” in FIG. 11, “non-reserved word 1” includes, for example, the value of “non-reserved word 1” in the record of the corresponding reserved word “IF”. You can also have Although the nested syntax element TSV (Tab Separated Values / tab delimiter) is TSV, it is not necessarily in the tab delimited format.

続いて、一実施形態に係るソースコードの差分抽出および解析処理のうち、第3ステップ(図2のステップ203)となる新旧ソースコードの差分抽出および差分抽出結果データの生成について説明する。   Subsequently, in the source code difference extraction and analysis processing according to an embodiment, the new and old source code difference extraction and generation of difference extraction result data, which is the third step (step 203 in FIG. 2), will be described.

第3ステップでは、第2ステップで生成した新旧ソースコードのネスト・構文要素TSV1101および1201の各々をインプットとし、差分抽出を行い、差分抽出結果データをアウトプットとして生成する。当該差分抽出は、従来技術と同等のものであり、新旧ソースコードのネスト・構文要素TSVの各レコードを「行番号」順に比較することにより、変更されたレコード(すなわち、新旧ソースコードにおける変更行)を特定する。   In the third step, the new and old source code nested / syntax elements TSV 1101 and 1201 generated in the second step are used as inputs, difference extraction is performed, and difference extraction result data is generated as output. The difference extraction is equivalent to the conventional technique, and the records (ie, changed lines in the old and new source code) are changed by comparing the records of the nested and syntactic elements TSV of the old and new source codes in the order of “line numbers”. ).

図13は、本発明の一実施形態に係る差分抽出結果を示す図である。図13において、差分抽出結果データ1301の1行目(1302)の「2,6c2」は、「旧ソースコードの2〜6行目を、新ソースコードの2行目に変更した。」ことを示す。なお、「c」は、変更を意味する「change」の頭文字であるが、別の識別子を用いてもよい。また、「c」の他に、追加を意味する「add」の頭文字の「a」、削除を意味する「delete」の頭文字の「d」を用いて、行の追加や削除を示すことができる。例えば、「(旧ソースコードの0行目の位置に)新ソースコードの1〜3行目を追加した。」ことを示すために「0a1,3」、または「旧ソースコードの2〜5行目を削除した(削除部分は、新ソースコードでは、1行目となる)。」ことを示すために「2,5d1」などと示すことができる。また、ソースコードの2〜5行目を意味する「2,5」は、「2-5」などと表記することもできる。   FIG. 13 is a diagram illustrating a difference extraction result according to an embodiment of the present invention. In FIG. 13, “2,6c2” in the first line (1302) of the difference extraction result data 1301 indicates that “the second to sixth lines of the old source code are changed to the second line of the new source code”. Show. Note that “c” is an acronym for “change” meaning change, but another identifier may be used. In addition to “c”, use “a” as an acronym for “add” to indicate addition and “d” as an acronym for “delete” to indicate deletion. Can do. For example, “0a1,3” or “2-5 lines of the old source code” to indicate that “the 1st to 3rd lines of the new source code have been added (in the position of the 0th line of the old source code)” "2-5d1" can be shown to indicate that the eye has been deleted (the deleted part is the first line in the new source code). In addition, “2,5” meaning the second to fifth lines of the source code can be expressed as “2-5”.

次に、図13における差分抽出結果データ1301の2〜6行目(1303)は、左矢印を意味する「<」識別子を持つ旧内容部分であり、8行目(1305)は、右矢印を意味する「>」識別子を持つ新内容部分である。すなわち、「<」および「>」識別子は、「旧ソースコード→新ソースコード」への変更を意味するものであるが、別の表現を用いることもできる。また、7行目(1304)の「---」は新旧ソースコードの区切りを意味するものであるが、同様に別の表記を用いることもできる。なお、「<」および「>」識別子の隣の数値は、各レコードのネスト数を表す。   Next, the second to sixth lines (1303) of the difference extraction result data 1301 in FIG. 13 are the old content part having the “<” identifier meaning the left arrow, and the eighth line (1305) represents the right arrow. It is a new content part with a ">" identifier meaning. That is, the “<” and “>” identifiers mean a change from “old source code → new source code”, but other expressions can also be used. Further, “---” in the seventh line (1304) means a break between the old and new source codes, but another notation can be used similarly. The numerical values next to the “<” and “>” identifiers represent the number of nesting of each record.

さらに変更、追加、削除がある場合は、1306に示すように追加して示すことができる。また、差分抽出結果データ1301を、図5に示すように新旧ソースコードの行を対応付けて生成することもできる。いずれにせよ、図13における差分抽出は、従来技術と同等のものであるため、行変更の場合は、旧ソースコードのある行に対して何らかの変更が行われ、新ソースコードのある行に変更された、ことしか示さない。そのため、次ステップにて、本ステップで生成した差分抽出結果データ1301をさらに解析する。   Further, when there is a change, addition, or deletion, it can be additionally shown as shown in 1306. Further, the difference extraction result data 1301 can be generated by associating old and new source code lines as shown in FIG. In any case, since the difference extraction in FIG. 13 is equivalent to the conventional technique, in the case of line change, some change is made to a line with the old source code, and the line is changed to a line with the new source code. It has only been shown. Therefore, in the next step, the difference extraction result data 1301 generated in this step is further analyzed.

続いて、一実施形態に係るソースコードの差分抽出および解析処理のうち、第4ステップ(図2のステップ204)となる差分抽出結果データ1301の解析および差分解析結果データ1801の生成について説明する。   Subsequently, analysis of difference extraction result data 1301 and generation of difference analysis result data 1801 as a fourth step (step 204 in FIG. 2) in the source code difference extraction and analysis processing according to an embodiment will be described.

第4ステップでは、第3ステップで生成した差分抽出結果データ1301をインプットとし、さらに解析を行い、後述する差分解析結果データ1801をアウトプットとして生成する。差分抽出結果データ1301の解析は、差分抽出結果データ1301における旧内容部分1303および新内容部分1305の各行における予約語および非予約語を、後述する一致判別ルール、および条件追加・削除抽出ルールに基づいて、比較し、差分として抽出された各行の変更がどのような変更(行追加・削除、条件の追加・削除、など)なのかを解析する。また、各ネスト数を比較することで、字上げ・字下げによる変更の有無を解析する。   In the fourth step, the difference extraction result data 1301 generated in the third step is used as an input, further analysis is performed, and later-described difference analysis result data 1801 is generated as an output. The analysis of the difference extraction result data 1301 is based on a match determination rule and a condition addition / deletion extraction rule described later for reserved words and non-reserved words in each row of the old content portion 1303 and the new content portion 1305 in the difference extraction result data 1301. The change of each line extracted as the difference is analyzed (such as line addition / deletion, condition addition / deletion, etc.). In addition, by comparing each nest number, the presence or absence of a change due to indentation / indentation is analyzed.

図14は、本発明の一実施形態に係る差分解析処理フローを示す図である。図14に係る処理フローが、第4ステップの詳細フローになる。   FIG. 14 is a diagram showing a difference analysis processing flow according to an embodiment of the present invention. The processing flow according to FIG. 14 is the detailed flow of the fourth step.

ステップ1401にて、差分抽出結果データ1301から1ブロック分のデータ(例えば図13の1306。以下、「差分ブロックデータ」という)を取得する。ここで差分ブロックデータが取得できない場合、すなわちファイルの終端である場合は、ステップ1402の「Yes」に進み、処理は終了する。差分ブロックデータが取得できた場合は、ステップ1402の「No」に進み、差分ブロックデータに含まれる差分識別子が「変更」(例えば「c」)を示すか判定が行われる(ステップ1403)。差分識別子が「変更」以外(例えば、「追加」を示す「a」または「削除」を示す「d」)であれば、これ以上の解析は不要であるため、取得した差分ブロックデータをそのまま差分解析結果として出力する(ステップ1404)。ステップ1404にて差分ブロックデータを出力した後、ステップ1401に戻り、次の変更の解析を行うか(ステップ1402の「No」ルート)、次の変更が無い場合は処理が終了する(ステップ1402の「Yes」ルート)。   In step 1401, data for one block (for example, 1306 in FIG. 13; hereinafter referred to as “difference block data”) is acquired from the difference extraction result data 1301. If the difference block data cannot be obtained, that is, if it is the end of the file, the process proceeds to “Yes” in step 1402 and the process ends. If the difference block data can be acquired, the process proceeds to “No” in step 1402 to determine whether or not the difference identifier included in the difference block data indicates “change” (for example, “c”) (step 1403). If the difference identifier is other than “change” (for example, “a” indicating “addition” or “d” indicating “deletion”), no further analysis is necessary, and the acquired difference block data is directly used as a difference. An analysis result is output (step 1404). After outputting the difference block data in step 1404, the process returns to step 1401 to analyze the next change (“No” route in step 1402), or the process ends if there is no next change (in step 1402). "Yes" route).

ステップ1403にて、差分識別子が「変更」を示す場合、差分ブロックデータに含まれる新内容部分から1行取得する(ステップ1405)。ここで新内容部分が複数行ある場合は、上から取得し、処理を繰り返す際に次の行を取得する。ステップ1405にて、行が取得できない場合、すなわち新内容部分の終端である場合は、ステップ1406の「Yes」に進み、ステップ1401に戻る。   If the difference identifier indicates “change” in step 1403, one line is acquired from the new content portion included in the difference block data (step 1405). Here, when there are a plurality of new content parts, it is acquired from above, and the next line is acquired when the process is repeated. If it is determined in step 1405 that a line cannot be obtained, that is, if it is the end of the new content portion, the process proceeds to “Yes” in step 1406 and returns to step 1401.

一方、行が取得でき、新内容部分の終端ではない場合、ステップ1406の「No」に進み、差分ブロックデータの旧内容部分から1行取得する(ステップ1407)。ここでも、旧内容部分が複数行ある場合は、上から取得し、処理を繰り返す際に次の行を取得する。ステップ1407にて、行が取得でき、旧内容部分の終端ではない場合、ステップ1408の「No」に進み、一致判別ルールに従って、新旧内容部分の1行がお互いに一致するか否かを比較する(ステップ1409)。ステップ1409、すなわち一致判別ルールに従った判定処理の詳細については、図15の説明として後述する。   On the other hand, if a row can be acquired and it is not the end of the new content portion, the process proceeds to “No” in step 1406 to acquire one row from the old content portion of the difference block data (step 1407). Again, if there are multiple lines of old content, it is acquired from above and the next line is acquired when the process is repeated. If a line can be acquired in step 1407 and it is not the end of the old content part, the process proceeds to “No” in step 1408 to compare whether or not one line of the new and old content part matches each other according to the match determination rule. (Step 1409). Details of the determination processing according to step 1409, that is, the match determination rule will be described later with reference to FIG.

ステップ1409にて、取得した新旧内容部分の各1行が変更について対応する行として一致しないと判定された場合、新旧内容部分の1行を旧内容部分の次の行と比較するため、ステップ1410の「No」に進み、ステップ1407に戻る。一方、対応する行として一致すると判定された場合、ステップ1410の「Yes」に進み、条件追加・削除抽出ルールに従って差分解析結果を出力する(ステップ1411)。ステップ1411、すなわち条件追加・削除抽出ルールに従った解析処理の詳細については、図16の説明として後述する。   If it is determined in step 1409 that each line of the acquired old and new content part does not match as a corresponding line for the change, step 1410 is performed to compare one line of the old and new content part with the next line of the old content part. The process proceeds to “No” and returns to step 1407. On the other hand, if it is determined that the lines match, the process proceeds to “Yes” in step 1410, and the difference analysis result is output according to the condition addition / deletion extraction rule (step 1411). Details of the analysis processing according to step 1411, that is, the condition addition / deletion extraction rule will be described later with reference to FIG.

次にステップ1411にて出力した差分解析結果が「変更候補に追加」か否か判定する(ステップ1412)。「変更候補に追加」というのは、後述するが、変更の可能性が高いが、変更であることを未だ確定できないものを一時的に変更候補(リスト)に追加し、新内容部分の1行と旧内容部分の次の行との比較をさらに行うことが必要であることを意味する。そのため、ステップ1412にて、出力した差分解析結果が「変更候補に追加」であると判定された場合、「Yes」に進み、変更候補リストに変更候補を追加し(ステップ1417)、ステップ1407に戻る。ここで、変更候補リスト(図示せず)は、コンピュータ100上のメモリ103に展開される一時的なデータ領域であり、例えばリスト構造で、変更候補であると判定された、取得した新内容部分の1行を格納する。   Next, it is determined whether or not the difference analysis result output in step 1411 is “add to change candidate” (step 1412). “Add to change candidate” is described later, but the possibility of change is high, but a change that has not been confirmed yet is temporarily added to the change candidate (list). And the next line of the old content part needs to be further compared. Therefore, when it is determined in step 1412 that the output difference analysis result is “add to change candidate”, the process proceeds to “Yes” to add the change candidate to the change candidate list (step 1417). Return. Here, the change candidate list (not shown) is a temporary data area developed in the memory 103 on the computer 100. For example, the acquired new content portion determined to be a change candidate in the list structure. Is stored.

一方、ステップ1412にて、出力した差分解析結果が「変更候補に追加」ではないと判定された場合、「No」に進み、字上げ・字下げ抽出ルールに従って、差分解析結果を出力する(ステップ1413)。ステップ1413、すなわち字上げ・字下げ抽出ルールに従った解析処理の詳細については、図17の説明として後述する。   On the other hand, if it is determined in step 1412 that the output difference analysis result is not “add to change candidate”, the process proceeds to “No” and the difference analysis result is output according to the indentation / indentation extraction rule (step 1413). Details of the analysis processing according to step 1413, that is, the indentation / indentation extraction rule will be described later with reference to FIG.

次に、旧内容部分1302に、差分解析結果として出力していない行が存在するか否かを判定する(ステップ1414)。差分解析結果として出力していない行が存在しない場合は、ステップ1416に進み、未出力行が存在する場合は、当該未出力行を削除行と判断して差分解析結果を出力する(ステップ1415)。続いて、ステップ1416にて、変更候補リストを空にして(初期化して)、ステップ1405に戻り、新内容部分の次の行の解析を行う。   Next, it is determined whether or not there is a line not output as a difference analysis result in the old content portion 1302 (step 1414). If there is no line that has not been output as the difference analysis result, the process proceeds to step 1416. If there is an unoutput line, the non-output line is determined to be a deleted line and the difference analysis result is output (step 1415). . Subsequently, in step 1416, the change candidate list is emptied (initialized), and the process returns to step 1405 to analyze the next line of the new content portion.

一方、ステップ1407にて、旧内容部分から行が取得できず、旧内容部分の終端である場合、ステップ1408の「Yes」に進み、変更候補リストが空か否かの判定を行う(ステップ1418)。ステップ1418にて、変更候補リストが空でない場合、「No」に進み、変更候補リストの1つ目(例えば、ステップ1417にて格納された、新内容部分の1行)を「変更」と判断して差分解析結果を出力し(ステップ1419)、ステップ1416に進む。ステップ1419において、変更候補リストの1つ目を「変更」と判断するのは、最も先に格納されたものが最も変更行である可能性の高いものとみなすためである。また、ステップ1419をはじめとする差分解析処理フローのいくつかのステップにおいて出力される差分解析結果は、図18の説明にて後述するが、例えば、「変更」と判断された新旧内容部分の行および行番号、ならびにどのような変更かを示す差分識別子である。ここで差分識別子とは、例えば、差分抽出結果データ1301の識別子のように、変更を意味する「change」の頭文字である「c」、追加を意味する「add」の頭文字の「a」、削除を意味する「delete」の頭文字の「d」、条件文の条件の追加を意味する「condition add」の頭文字の「ca」、および条件文の条件の削除を意味する「condition delete」の頭文字の「cd」などである。ステップ1419では「変更」と判断されたたため、「c」を出力する。但し、別の識別子を用いてもよい。結果として、ステップ1419にて出力される差分解析結果とは、例えば、図13に示される差分抽出結果データ1301と同形式で出力することができる。別の実施形態では、図6および7に示されるように、新旧内容部分を横並びにし、変更行を対比できるように出力することもできる。   On the other hand, if it is determined in step 1407 that a line cannot be obtained from the old content portion and the end of the old content portion is reached, the process proceeds to “Yes” in step 1408 to determine whether the change candidate list is empty (step 1418). ). If the change candidate list is not empty in step 1418, the process proceeds to “No”, and the first change candidate list (for example, one line of the new content portion stored in step 1417) is determined to be “change”. The difference analysis result is output (step 1419), and the process proceeds to step 1416. In step 1419, the first change candidate list is determined to be “change” because it is considered that the most recently stored line is the most likely changed line. Further, the difference analysis results output in several steps of the difference analysis processing flow including step 1419 will be described later in the description of FIG. 18. For example, the old and new content portion lines determined to be “changed” And a line number and a difference identifier indicating what kind of change it is. Here, the difference identifier is, for example, “c”, which is an acronym of “change” meaning change, and “a”, which is an acronym of “add”, meaning addition, like the identifier of the difference extraction result data 1301. , “D” for the initial “delete” meaning deletion, “ca” for the initial “condition add” meaning adding a conditional statement, and “condition delete” meaning deleting a conditional statement condition "Cd", etc. In step 1419, since “change” is determined, “c” is output. However, another identifier may be used. As a result, the difference analysis result output in step 1419 can be output in the same format as, for example, the difference extraction result data 1301 shown in FIG. In another embodiment, as shown in FIGS. 6 and 7, the old and new content portions may be placed side by side and output so that the changed rows can be compared.

一方、変更候補リストが空の場合、「Yes」に進み、取得した新内容部分の1行を「追加」と判断して差分解析結果を出力し(ステップ1420)、ステップ1405に戻り、新内容部分の次の行の解析を行う。ステップ1420において出力される差分解析結果は、ステップ1419にて上述したものと同様である。   On the other hand, if the change candidate list is empty, the process proceeds to “Yes”, one line of the acquired new content part is determined as “added”, and the difference analysis result is output (step 1420). Parse the next line of the part. The difference analysis result output in step 1420 is the same as that described above in step 1419.

以上の処理を、差分抽出結果データ1301のファイルの終端まで行い、後述する差分解析結果データ1801を得る。以上、差分解析処理の詳細について説明したが、ステップ1413に示す字上げ・字下げに係る差分解析など、処理の一部は、必ずしも図14に示す差分解析処理フローの中で実施する必要は無く、別処理として分離して実行することができることを当業者であれば理解できよう。   The above processing is performed up to the end of the file of the difference extraction result data 1301 to obtain difference analysis result data 1801 described later. The details of the difference analysis processing have been described above. However, a part of the processing such as difference analysis related to indentation / indentation shown in step 1413 is not necessarily performed in the difference analysis processing flow shown in FIG. Those skilled in the art will understand that they can be executed separately as separate processes.

次に、ステップ1409、すなわち一致判別ルールに従った判定処理の詳細について説明する。図15は、本発明の一実施形態に係る一致判別ルールに従った判定処理フローを示す図である。ステップ1501にて、取得した新旧内容部分の各1行の予約語が一致するか否かを判定する。ステップ1501にて、一致しないと判定された場合、「No」に進み、取得した新旧内容部分の各1行は変更について対応する行として不一致であると判定され(ステップ1510)、処理は終了する。   Next, details of determination processing according to step 1409, that is, the matching determination rule will be described. FIG. 15 is a diagram showing a determination processing flow according to the match determination rule according to the embodiment of the present invention. In step 1501, it is determined whether or not the reserved words in each line of the acquired old and new content portions match. If it is determined in step 1501 that they do not match, the process proceeds to “No”, and it is determined that each of the acquired old and new content portions does not match as a corresponding row for the change (step 1510), and the process ends. .

一方、ステップ1501にて、一致すると判定された場合、一致する予約語が「IF」であるか否か判定する(ステップ1502)。ステップ1502にて、一致する予約語が「IF」であると判定された場合、「Yes」に進み、当該予約語に対応する非予約語の全てが、取得した新旧内容部分において一致するか否かを判定する(ステップ1503)。ステップ1503にて、一致すると判定された場合、「Yes」に進み、取得した新旧内容部分の各1行は変更について対応する行として一致すると判定され(ステップ1504)、処理は終了する。   On the other hand, if it is determined in step 1501 that they match, it is determined whether or not the matching reserved word is “IF” (step 1502). If it is determined in step 1502 that the matching reserved word is “IF”, the process proceeds to “Yes”, and whether or not all of the non-reserved words corresponding to the reserved word match in the acquired old and new content portion. Is determined (step 1503). If it is determined in step 1503 that they match, the process proceeds to “Yes”, and each of the acquired old and new content portions is determined to match as a corresponding row for the change (step 1504), and the process ends.

一方、ステップ1503にて、一致しないと判定された場合、「No」に進み、対応する非予約語の一方が他方の部分集合となるか否かを判定する(ステップ1505)。ステップ1505にて、部分集合となると判定された場合、「Yes」に進み、取得した新旧内容部分の各1行は変更について対応する行として一致すると判定され(ステップ1504)、処理は終了する。ここで、部分集合とは例えば、非予約語について、旧内容部分が「QTY = 0 AND ID ! = 4」であり、新内容部分が「QTY = 0 AND ID ! = 4 AND ID ! = 5」である場合に、旧内容部分は新内容部分の部分集合であるといえる。   On the other hand, if it is determined in step 1503 that they do not match, the process proceeds to “No”, and it is determined whether one of the corresponding non-reserved words is the other subset (step 1505). If it is determined in step 1505 that it is a subset, the process proceeds to “Yes”, and it is determined that each of the acquired old and new content portions matches as a corresponding row for the change (step 1504), and the process ends. Here, the subset is, for example, for a non-reserved word, the old content part is "QTY = 0 AND ID! = 4", and the new content part is "QTY = 0 AND ID! = 4 AND ID! = 5" The old content part is a subset of the new content part.

一方、ステップ1505にて、部分集合とはならないと判定された場合、「No」に進み、取得した新旧内容部分の各1行は変更について対応する行として不一致であると判定され(ステップ1506)、処理は終了する。   On the other hand, if it is determined in step 1505 that the set is not a subset, the process proceeds to “No”, and it is determined that each line of the acquired old and new contents part is inconsistent as a corresponding line for the change (step 1506). The process ends.

ステップ1502にて、一致する予約語が「IF」ではないと判定された場合、「No」に進み、当該予約語に対応する非予約語が全て一致するか否かを判定する(ステップ1507)。ステップ1507にて、一致すると判定された場合、「Yes」に進み、取得した新旧内容部分の各1行は変更について対応する行として一致すると判定され(ステップ1508)、処理は終了する。   If it is determined in step 1502 that the matching reserved word is not “IF”, the process proceeds to “No”, and it is determined whether or not all non-reserved words corresponding to the reserved word match (step 1507). . If it is determined in step 1507 that they match, the process proceeds to “Yes”, and it is determined that each of the acquired old and new content portions matches as a corresponding row for the change (step 1508), and the process ends.

一方、ステップ1507にて、一致しないと判定された場合、「No」に進み、対応する予約語に異なるものが2つ以上あるか否かの判定を行う(ステップ1509)。ステップ1509にて、異なるものが2つ以上あると判定された場合、「Yes」に進み、取得した新旧内容部分の各1行は変更について対応する行として不一致であると判定され(ステップ1510)、処理は終了する。一方、ステップ1509にて、異なるものが2つ以上ないと判定された場合、「No」に進み、取得した新旧内容部分の各1行は変更について対応する行として一致すると判定され(ステップ1508)、処理は終了する。   On the other hand, if it is determined in step 1507 that they do not match, the process proceeds to “No”, and it is determined whether there are two or more different corresponding reserved words (step 1509). If it is determined in step 1509 that there are two or more different items, the process proceeds to “Yes”, and it is determined that each one line of the acquired old and new content portions does not match as a corresponding line for the change (step 1510). The process ends. On the other hand, if it is determined in step 1509 that there are not two or more different ones, the process proceeds to “No”, and it is determined that each one line of the acquired old and new content portions matches as a corresponding line for the change (step 1508). The process ends.

次に、図14のステップ1411、すなわち条件追加・削除抽出ルールに従った解析処理の詳細について説明する。図16は、本発明の一実施形態に係る条件追加・削除抽出ルールに従った解析処理フローを示す図である。ステップ1601にて、取得した新旧内容部分の各1行の予約語が「IF」であるか否か判定する。ステップ1601にて、一致する予約語が「IF」であると判定された場合、「Yes」に進み、当該予約語に対応する非予約語の全てが、取得した新旧内容部分において一致するか否かを判定する(ステップ1602)。ステップ1602にて、一致すると判定された場合、「Yes」に進み、処理は終了する。   Next, step 1411 in FIG. 14, that is, details of the analysis processing according to the condition addition / deletion extraction rule will be described. FIG. 16 is a diagram showing an analysis processing flow according to the condition addition / deletion extraction rule according to the embodiment of the present invention. In step 1601, it is determined whether or not the reserved word in each line of the acquired old and new contents portion is “IF”. If it is determined in step 1601 that the matching reserved word is “IF”, the process proceeds to “Yes”, and whether or not all of the non-reserved words corresponding to the reserved word match in the acquired old and new content portion. Is determined (step 1602). If it is determined in step 1602 that they match, the process proceeds to “Yes” and the process ends.

一方、ステップ1602にて、一致しないと判定された場合、「No」に進み、対応する非予約語の一方が他方の部分集合となるか否かを判定する(ステップ1603)。ステップ1603にて、部分集合とはならないと判定された場合、「No」に進み、処理は終了する。   On the other hand, if it is determined in step 1602 that they do not match, the process proceeds to “No”, and it is determined whether one of the corresponding non-reserved words is the other subset (step 1603). If it is determined in step 1603 that it is not a subset, the process proceeds to “No” and the process ends.

一方、ステップ1603にて、部分集合となると判定された場合、「Yes」に進み、取得した旧内容部分の1行が、取得した新内容部分の1行の部分集合であるか否かの判定を行う(ステップ1604)。ステップ1604にて、部分集合であると判定された場合、「Yes」に進み、取得した新内容部分の1行を「条件の追加」と判断して差分解析結果を出力する(ステップ1605)。ステップ1605において出力される差分解析結果は、例えば、条件文の条件の追加を意味する「condition add」の頭文字の「ca」である。   On the other hand, if it is determined in step 1603 that it is a subset, the process proceeds to “Yes”, and it is determined whether one row of the acquired old content portion is a subset of one row of the acquired new content portion. (Step 1604). If it is determined in step 1604 that it is a subset, the process proceeds to “Yes”, and one line of the acquired new content portion is determined as “addition of condition” and a difference analysis result is output (step 1605). The difference analysis result output in step 1605 is, for example, “ca” as an acronym for “condition add” meaning addition of a condition sentence condition.

一方、ステップ1604にて、部分集合でないと判定された場合、「No」に進み、差分解析結果として、取得した新内容部分の1行を「条件の削除」と判断して差分解析結果を出力する(ステップ1606)。ステップ1606において出力される差分解析結果は、例えば、条件文の条件の削除を意味する「condition delete」の頭文字の「cd」である。   On the other hand, if it is determined in step 1604 that it is not a subset, the process proceeds to “No”, and as the difference analysis result, one line of the acquired new content portion is determined as “deletion of condition” and the difference analysis result is output. (Step 1606). The difference analysis result output in step 1606 is, for example, “cd” as an acronym for “condition delete”, which means deletion of a condition sentence.

ステップ1601にて、一致する予約語が「IF」でないと判定された場合、「No」に進み、対応する非予約語に異なるものが2つ以上あるか否かを判定する(ステップ1607)。ステップ1607にて、異なるものが2つ以上あると判定された場合、「Yes」に進み、処理は終了する。一方、異なるものが2つ以上ないと判定された場合、「No」に進み、差分解析結果として、「変更候補に追加」と判定する(ステップ1609)。   When it is determined in step 1601 that the matching reserved word is not “IF”, the process proceeds to “No”, and it is determined whether or not there are two or more different corresponding non-reserved words (step 1607). If it is determined in step 1607 that there are two or more different items, the process proceeds to “Yes” and the process ends. On the other hand, if it is determined that there are not two or more different items, the process proceeds to “No”, and it is determined as “add to change candidate” as the difference analysis result (step 1609).

次に、図14のステップ1413、すなわち字上げ・字下げ抽出ルールに従った解析処理の詳細について説明する。図17は、本発明の一実施形態に係る字上げ・字下げ抽出ルールに従った解析処理フローを示す図である。ステップ1701にて、取得した旧内容部分の1行のネスト数が、取得した新内容部分の1行のネスト数より大きいか否かを判定する。ステップ1701にて、旧内容部分の1行のネスト数の方が大きいと判定された場合、「Yes」に進み、取得した新内容部分の1行を「字上げ」と判断して差分解析結果を出力する(ステップ1702)。ステップ1702において出力される差分解析結果は、図18の説明にて後述するが、例えば、「字上げ」と判断された新旧内容部分の行および行番号、ならびに何文字分の字上げかを示す字上げ・字下げ識別子である。ここで、字上げ・字下げ識別子とは、例えば、2文字の字上げであれば「+2」、または1文字の字下げであれば「-1」などを出力する。但し、別の識別子を用いてもよい。   Next, details of the analysis processing according to step 1413 in FIG. 14, that is, the indentation / indentation extraction rule will be described. FIG. 17 is a diagram showing an analysis processing flow according to the indentation / indentation extraction rule according to the embodiment of the present invention. In step 1701, it is determined whether or not the number of nested lines in the acquired old content portion is larger than the number of nested lines in the acquired new content portion. If it is determined in step 1701 that the number of nestings in one line of the old content portion is larger, the process proceeds to “Yes”, and one line of the acquired new content portion is determined as “indentation” and the difference analysis result Is output (step 1702). The difference analysis result output in step 1702 will be described later with reference to FIG. 18. For example, it indicates the line and line number of the old and new content portion determined to be “indent”, and how many characters are to be indented. Indentation / indentation identifier. Here, as the indentation / indentation identifier, for example, “+2” is output if the character is indented by two characters, or “−1” is output if the indentation is one character. However, another identifier may be used.

一方、ステップ1701にて、旧内容部分の1行のネスト数の方が大きくない(等しい場合も含む)と判定された場合、「No」に進み、取得した旧内容部分の1行のネスト数が、取得した新内容部分の1行のネスト数より小さいか否かを判定する(ステップ1703)。ステップ1703にて、旧内容部分の1行のネスト数の方が小さいと判定された場合、「Yes」に進み、取得した新内容部分の1行を「字下げ」と判断して差分解析結果を出力する(ステップ1704)。ステップ1704において出力される差分解析結果は、ステップ1702にて上述したものと同様である。一方、ステップ1703にて、旧内容部分の1行のネスト数の方が小さくない、すなわち新旧内容部分の各1行のネスト数は等しいと判定された場合、ネスト数の変更は発生していないため、何も出力せず、処理は終了する。   On the other hand, if it is determined in step 1701 that the number of nested lines in the old content portion is not larger (including the case where they are equal), the process proceeds to “No” and the number of nested lines in the acquired old content portion Is smaller than the number of nestings in one line of the acquired new content portion (step 1703). If it is determined in step 1703 that the number of nestings in one line of the old content part is smaller, the process proceeds to “Yes”, and one line of the acquired new content part is determined as “indentation” and the difference analysis result Is output (step 1704). The difference analysis result output in step 1704 is the same as that described above in step 1702. On the other hand, if it is determined in step 1703 that the number of nests in one row of the old content portion is not smaller, that is, the number of nests in each row of the old and new content portions is equal, the number of nests has not changed. Therefore, nothing is output and the process ends.

以上の処理により、次に示す差分解析結果データ1801を得る。図18は、本発明の一実施形態に係る差分解析結果を示す図である。図18において、差分抽出結果データ1801の1行目(1802)の「2,5d」は、「旧ソースコードの2〜5行目を削除した。」ことを示す。「d」は、削除を意味する「delete」の頭文字である識別子であるが、差分解析結果データ1801において出力される識別子は、図14のステップ1419にて上述した差分識別子、およびステップ1702にて上述した字上げ・字下げである。図18における差分解析結果データ1801は、図13における差分抽出結果データ1301と同様の形式であり、より詳細な変更情報を示すことができる改良データである。そのため、「<」および「>」識別子、1807の「---」は、図13にて上述したものと同様であり、1803および1806は旧内容部分を、ならびに1808は新内容部分を、それぞれ示す。   Through the above processing, the following difference analysis result data 1801 is obtained. FIG. 18 is a diagram showing a difference analysis result according to an embodiment of the present invention. In FIG. 18, “2, 5d” in the first line (1802) of the difference extraction result data 1801 indicates that “the second to fifth lines of the old source code have been deleted”. “D” is an identifier that is an acronym for “delete” meaning deletion, but the identifier output in the difference analysis result data 1801 is the difference identifier described in step 1419 of FIG. The above-mentioned inflection / indentation. The difference analysis result data 1801 in FIG. 18 has the same format as the difference extraction result data 1301 in FIG. 13 and is improved data that can indicate more detailed change information. Therefore, the “<” and “>” identifiers and “---” in 1807 are the same as those described above with reference to FIG. 13, 1803 and 1806 indicate the old content portion, and 1808 indicates the new content portion, respectively. Show.

また、より詳細な変更情報とは、条件文の条件の追加である場合、例えば、「1ca1」(「旧ソースコードの1行目の条件文の条件を追加した。」ことを示す)と、条件文の条件の追加に係る新旧内容部分を出力する。また「旧ソースコードの1行目の条件文の条件を削除し、新ソースコードの4行目として出力した。」場合、「1cd4」と、条件文の条件の追加に係る新旧内容部分を出力する。なお、この場合、新ソースコードに、1〜3行目が追加されたこともわかる。もっとも、この場合、追加された1〜3行目が「0a1,3」として出力されるであろう。   Further, when the more detailed change information is the addition of a conditional statement condition, for example, “1ca1” (indicating that “the conditional statement condition of the first line of the old source code has been added”), Output the old and new contents related to the addition of conditions in the conditional statement. Also, if “Delete the condition of the conditional statement in the first line of the old source code and output it as the fourth line of the new source code”, output “1cd4” and the old and new contents part related to the addition of the conditional statement condition. To do. In this case, it can also be seen that the first to third lines are added to the new source code. However, in this case, the added first to third lines will be output as “0a1,3”.

また、さらなる、より詳細な変更情報とは、例えば、1805〜1808として示される字上げ・字下げの変更情報である。1805の「6 -2 2」は、「旧ソースコードの6行目が、2文字分、字下げされ、新ソースコードの2行目として出力した。」ことを示す。新ソースコードの2行目として出力されるのは、1802〜1803に示されるように、旧ソースコードの2〜5行目が削除されたためである。さらに変更がある場合は、差分解析結果データ1801に行を追加して示されることは当業者であれば理解されたい。また、差分解析結果データ1801を、図6に示すように新旧ソースコードの行を対応付けて生成することもできる。   Further, the more detailed change information is, for example, inflection / indentation change information indicated as 1805 to 1808. “6-22” in 1805 indicates that “the sixth line of the old source code is indented by two characters and output as the second line of the new source code”. The reason why it is output as the second line of the new source code is that the second to fifth lines of the old source code have been deleted, as shown in 1802-1803. It should be understood by those skilled in the art that when there is a further change, the difference analysis result data 1801 is indicated by adding a line. Also, the difference analysis result data 1801 can be generated by associating old and new source code lines as shown in FIG.

続いて、一実施形態に係るソースコードの差分抽出および解析処理のうち、第5ステップ(図2のステップ205)となる設計書の生成について説明する。   Next, generation of a design document, which is the fifth step (step 205 in FIG. 2), of the source code difference extraction and analysis processing according to an embodiment will be described.

図19は、本発明の一実施形態に係る設計書生成処理フローを示す図であり、図20は、本発明の一実施形態に係る予約語−日本語変換テーブルを示す図であり、図21は、本発明の一実施形態に係る設計書生成結果を示す図である。図19に係る処理フローが、第5ステップの詳細フローになる。本フローは、旧ネスト・構文要素TSVデータ1101をベースに、差分解析結果データ1801と、予約語−日本語変換テーブル2001とに基づき、図21に示すように設計書を生成する。なお、図21の本文出力部2101は、変換した結果の設計書本文、変更区分出力部2102には変更内容の詳細を出力する。   19 is a diagram showing a design document generation process flow according to an embodiment of the present invention, and FIG. 20 is a diagram showing a reserved word-Japanese conversion table according to an embodiment of the present invention. These are figures which show the design document production | generation result which concerns on one Embodiment of this invention. The processing flow according to FIG. 19 is a detailed flow of the fifth step. This flow generates a design document as shown in FIG. 21 based on the difference analysis result data 1801 and the reserved word-Japanese conversion table 2001 based on the old nest / syntax element TSV data 1101. Note that the text output unit 2101 in FIG. 21 outputs the converted design document text and the details of the change contents to the change category output unit 2102.

ステップ1901にて、旧ネスト・構文要素TSVデータ1101から1行取得する。ここで行が取得できる場合、すなわちファイルの終端でない場合は、ステップ1902の「No」に進み、取得した旧ネスト・構文要素TSVデータ1101の1行を予約語−日本語変換テーブル2001に基づき、変換し、設計書データとして出力する(ステップ1903)。   In step 1901, one line is acquired from the old nested / syntax element TSV data 1101. If the line can be acquired here, that is, if it is not the end of the file, the process proceeds to “No” in Step 1902, and one line of the acquired old nested / syntax element TSV data 1101 is based on the reserved word-Japanese conversion table 2001. The data is converted and output as design document data (step 1903).

ここで、予約語−日本語変換テーブル2001は、「予約語」と、「非予約語のリスト」と、「設計書への出力内容」とからなる。ここで、「設計書への出力内容」は、実際に設計書本文として、本文出力部2101に出力する内容であり、「%」で囲まれた文言は非予約語を示し、取得した旧ネスト・構文要素TSVデータ1101の1行に含まれる非予約語に応じて置換される。例えば、予約語「READ」について、差分解析結果データでは「READ Q-FILE.」となっており、「Q-FILE」が非予約語のFILE(ファイル名)を示す。この場合、「設計書への出力内容」に示される「%FILE%を読み込む」の「%FILE%」部分が「Q-FILE」に置換され、図21に示すように、「Q-FILEを読み込む」と出力される。   Here, the reserved word-Japanese conversion table 2001 includes “reserved words”, “a list of non-reserved words”, and “contents to be output to the design document”. Here, “output content to design document” is the content that is actually output to the text output unit 2101 as the text of the design document, and the wording enclosed in “%” indicates a non-reserved word and the acquired old nest Replacement is performed according to a non-reserved word included in one line of the syntax element TSV data 1101. For example, the reserved word “READ” is “READ Q-FILE.” In the difference analysis result data, and “Q-FILE” indicates a non-reserved word FILE (file name). In this case, the “% FILE%” portion of “Read% FILE%” shown in “Output contents to design document” is replaced with “Q-FILE”, and as shown in FIG. "Read" is output.

また、別の予約語を説明すると、例えば、予約語「IF」の場合、非予約語(すなわち条件)の数により、「%EXPR1%」、「%EXPR2%」、「%EXPR3%」・・・と置換する非予約語の数が異なり、各非予約語を結ぶ条件(AND、OR)により、「設計書への出力内容」に示す“かつ”または“または”の文字列が選択され、出力される。   Further, another reserved word is explained. For example, in the case of the reserved word “IF”, “% EXPR1%”, “% EXPR2%”, “% EXPR3%”, etc. depending on the number of non-reserved words (that is, conditions). The number of non-reserved words to be replaced is different, and the character string "and" or "or" shown in "Output contents to design document" is selected according to the conditions (AND, OR) connecting each non-reserved word, Is output.

ステップ1903の後、ステップ1901に戻り、旧ネスト・構文要素TSVデータ1101から行が取得できなくなるまで、ステップ1901〜1903を繰り返す。これは、旧ネスト・構文要素TSVデータ1101に基づき、予め旧内容部分を設計書データとして出力する考えである。別の実施形態では、予め旧内容部分を出力せずに、設計書データを生成することもできる。   After step 1903, the process returns to step 1901, and steps 1901 to 1903 are repeated until no line can be acquired from the old nest / syntax element TSV data 1101. This is based on the idea of outputting the old contents as design document data in advance based on the old nest / syntax element TSV data 1101. In another embodiment, the design document data can be generated without outputting the old content portion in advance.

旧ネスト・構文要素TSVデータ1101から行が取得できない場合、すなわちファイルの終端である場合は、ステップ1902の「Yes」に進み、差分解析結果データ1801から、差分識別子を含む行(例えば1802)から区切り行まで取得する。ここで、区切り行とは、例えば、空行1804であり、これら取得した複数行を「一差分データ」という。一差分データは、例えば、差分解析結果データ1801における1802〜1804である。また、別の一差分データは、1805〜1808である。図18の例では、2つの一差分データが含まれる。   If a line cannot be acquired from the old nest / syntax element TSV data 1101, that is, if it is the end of the file, the process proceeds to “Yes” in Step 1902, and from the differential analysis result data 1801 from the line including the differential identifier (for example, 1802). Get to the separator line. Here, the delimited lines are, for example, blank lines 1804, and these acquired plural lines are referred to as “one difference data”. One difference data is 1802-1804 in difference analysis result data 1801, for example. Another difference data is 1805 to 1808. In the example of FIG. 18, two pieces of one difference data are included.

ステップ1904にて行が取得できない場合、すなわちファイルの終端である場合は、ステップ1905の「Yes」に進み、処理は終了する。行が取得できた場合は、ステップ1905の「No」に進み、一差分データに含まれる差分識別子(例えば、1802および1805)が「追加」を示すか判定する(ステップ1906)。差分識別子が「追加」を示すと判定される場合(例えば「0a1,6」)、「Yes」に進み、取得した差分解析結果の新内容部分を予約語−日本語変換テーブルに基づいて変換し出力し(ステップ1907)、ステップ1904に戻る。この際、図21に示すように、変更区分出力部2102に、例えば「追加」という文字列を出力する。また、より強調するために、図21に示すように、項番を網掛けする、項番のフォント色を変更するなどによりハイライト表示することもできる。   If the line cannot be acquired in step 1904, that is, if it is the end of the file, the process proceeds to “Yes” in step 1905, and the process ends. If the line can be acquired, the process proceeds to “No” in Step 1905 to determine whether or not the difference identifier (for example, 1802 and 1805) included in one difference data indicates “added” (Step 1906). When it is determined that the difference identifier indicates “addition” (for example, “0a1,6”), the process proceeds to “Yes”, and the new content part of the obtained difference analysis result is converted based on the reserved word-Japanese conversion table. Output (step 1907), and return to step 1904. At this time, as shown in FIG. 21, for example, a character string “add” is output to the change classification output unit 2102. Further, for more emphasis, as shown in FIG. 21, it is possible to highlight the item number by shading the item number or changing the font color of the item number.

ステップ1906にて、差分識別子が「追加」を示さないと判定される場合、「No」に進み、差分識別子が「変更」を示すか判定する(ステップ1908)。差分識別子が「変更」を示すと判定される場合(例えば「8c8」)、「Yes」に進み、取得した差分解析結果の新内容部分を予約語−日本語変換テーブルに基づいて変換し出力し(ステップ1907)、さらに設計書に出力した該当行(旧内容部分において変更する行)を削除用の表記に変換し(ステップ1911)、ステップ1904に戻る。この際、図21に示すように、本文出力部2101には、旧内容を取り消し線により修飾して出力し、そのすぐ下に、新内容を出力する。また、変更区分出力部2102には、例えば「変更」という文字列を出力する。さらに、より強調するために、図21に示すように、旧内容部分と新内容部分を異なる色で網掛けする、フォント色を変更するなどによりハイライト表示することもできる。   If it is determined in step 1906 that the difference identifier does not indicate “add”, the process proceeds to “No”, and it is determined whether the difference identifier indicates “change” (step 1908). When it is determined that the difference identifier indicates “change” (for example, “8c8”), the process proceeds to “Yes”, and the new content part of the obtained difference analysis result is converted and output based on the reserved word-Japanese conversion table. (Step 1907) Further, the corresponding line output to the design document (the line to be changed in the old content part) is converted into a notation for deletion (Step 1911), and the process returns to Step 1904. At this time, as shown in FIG. 21, to the text output unit 2101, the old content is output with a strikethrough, and the new content is output immediately below. Further, for example, a character string “change” is output to the change category output unit 2102. Furthermore, for more emphasis, as shown in FIG. 21, the old content portion and the new content portion can be highlighted by changing the font color, for example, by shading with different colors.

ステップ1908にて、差分識別子が「変更」を示さないと判定される場合、「No」に進み、差分識別子が「削除」を示すか判定する(ステップ1910)。差分識別子が「削除」を示すと判定される場合(例えば「1,10d1」)、「Yes」に進み、設計書に出力した該当行(旧内容部分において削除する行)を削除用の表記に変換し(ステップ1911)、ステップ1904に戻る。この際、図21に示すように、本文出力部2101には、取り消し線により修飾されて出力される。ここで取り消し線以外の修飾(例えば、薄い文字)により、出力することができることも当業者であれば理解されたい。また、変更区分出力部2102には、例えば「削除」という文字列を出力する。また、より強調するために、図21に示すように、網掛けするなどによりハイライト表示することもできる。   If it is determined in step 1908 that the difference identifier does not indicate “change”, the process proceeds to “No” to determine whether the difference identifier indicates “delete” (step 1910). When it is determined that the difference identifier indicates “deleted” (for example, “1,10d1”), the process proceeds to “Yes”, and the corresponding line output to the design document (the line to be deleted in the old content part) is used as the notation for deletion. Conversion is performed (step 1911), and the process returns to step 1904. At this time, as shown in FIG. 21, the text output unit 2101 is output after being modified by a strikethrough. It should also be understood by those skilled in the art that the output can be made with modifications other than the strikethrough (for example, thin characters). Also, for example, a character string “delete” is output to the change category output unit 2102. Further, for more emphasis, as shown in FIG. 21, it can be highlighted by shading.

ステップ1910にて、差分識別子が「削除」を示さないと判定される場合、「No」に進み、差分識別子が「条件の追加」を示すか判定する(ステップ1912)。差分識別子が「条件の追加」を示すと判定される場合(例えば「12ca12」)、「Yes」に進み、取得した差分解析結果の新内容部分を予約語−日本語変換テーブルに基づいて、設計書に出力した該当部分(旧内容部分の条件文において条件を追加する部分)に追加し(ステップ1913)、ステップ1904に戻る。この際、図21に示すように、本文出力部2101には、追加する部分を、網掛けする、フォント色を変更するなどして出力する。また、変更区分出力部2102には、例えば「条件の追加」という文字列を出力する。   If it is determined in step 1910 that the difference identifier does not indicate “delete”, the process proceeds to “No”, and it is determined whether the difference identifier indicates “addition of condition” (step 1912). When it is determined that the difference identifier indicates “additional condition” (for example, “12ca12”), the process proceeds to “Yes”, and the new content part of the obtained difference analysis result is designed based on the reserved word-Japanese conversion table. Is added to the corresponding part output to the document (the part to which the condition is added in the conditional sentence of the old content part) (step 1913), and the process returns to step 1904. At this time, as shown in FIG. 21, the added part is output by shading the added part, changing the font color, or the like. Also, for example, a character string “addition of condition” is output to the change category output unit 2102.

ステップ1912にて、差分識別子が「条件の追加」を示さないと判定される場合、「No」に進み、差分識別子が「条件の削除」を示すか判定する(ステップ1914)。差分識別子が「条件の削除」を示すと判定される場合(例えば「14cd14」)、「Yes」に進み、設計書に出力した該当部分(旧内容部分の条件文において条件を削除する部分)を削除用の表記に変換し(ステップ1915)、ステップ1904に戻る。この際、図示していないが、本文出力部2101には、削除する部分を取り消し線により修飾するなどして出力し、また変更区分出力部2102には、例えば「条件の削除」という文字列を出力する。   If it is determined in step 1912 that the difference identifier does not indicate “addition of condition”, the process proceeds to “No”, and it is determined whether the difference identifier indicates “deletion of condition” (step 1914). When it is determined that the difference identifier indicates “deletion of condition” (for example, “14cd14”), the process proceeds to “Yes” and the corresponding part output to the design document (the part in which the condition is deleted in the conditional statement of the old content part) The notation for deletion is converted (step 1915), and the process returns to step 1904. At this time, although not shown, the text output unit 2101 outputs the part to be deleted by modifying it with a strikethrough, and the change category output unit 2102 receives, for example, a character string “deletion of condition”. Output.

ステップ1914にて、差分識別子が「条件の削除」を示さないと判定される場合、「No」に進み、差分識別子が「字上げ」または「字下げ」を示すか判定する(ステップ1916)。差分識別子が「字上げ」または「字下げ」を示すと判定される場合(例えば「16 +1 16」、または「16 -2 16」)、「Yes」に進み、設計書に出力した該当行(旧内容部分において字上げ、または字下げする行)を、差分識別子で示される文字数分、字上げ、または字下げし(ステップ1917)、ステップ1904に戻る。この際、図21に示すように、変更区分出力部2102に、例えば「2文字字下げ」という文字列を出力する。また、より強調するために、図21に示すように、項番を網掛けする、項番のフォント色を変更するなどによりハイライト表示することもできる。なお、図21に示される「11.」などの項番は、出力した設計書の可読性を向上させるため、ネスト数に応じて、連番を付与したものであるため、必ずしも出力する必要はない、または別の表記で出力することができることを理解されたい。   If it is determined in step 1914 that the difference identifier does not indicate “deletion of condition”, the process proceeds to “No” to determine whether the difference identifier indicates “indentation” or “indentation” (step 1916). If it is determined that the difference identifier indicates “indentation” or “indentation” (for example, “16 +1 16” or “16 -2 16”), proceed to “Yes” and the corresponding line output to the design document Indent (in the old content part) is indented or indented by the number of characters indicated by the difference identifier (step 1917), and the process returns to step 1904. At this time, as shown in FIG. 21, for example, a character string “2 character indentation” is output to the change classification output unit 2102. Further, for more emphasis, as shown in FIG. 21, it is possible to highlight the item number by shading the item number or changing the font color of the item number. Note that item numbers such as “11.” shown in FIG. 21 are not necessarily output because item numbers are assigned according to the number of nests in order to improve the readability of the output design document. It should be understood that it can be output in a different notation.

ステップ1916にて、差分識別子が「字上げ」または「字下げ」を示さないと判定される場合、「No」に進み、ステップ1904に戻る。もっともこの場合、差分識別子が想定された差分識別子を示さないことになるため、本ルートは、例外ルートであるといえる。そのため、本ルートに例外処理を入れることもできる。   If it is determined in step 1916 that the difference identifier does not indicate “indent” or “indent”, the process proceeds to “No” and returns to step 1904. However, in this case, since the difference identifier does not indicate the assumed difference identifier, it can be said that this route is an exceptional route. Therefore, exception handling can be included in this route.

なお、ステップ1906〜1916において、差分識別子の判定処理について上述したが、この際の判定する順番は一実施例であり、判定の順番を任意に変更して処理することができることは当業者であれば理解されたい。   Note that, in steps 1906 to 1916, the difference identifier determination processing has been described above, but the determination order in this case is an example, and it is a person skilled in the art that the determination order can be arbitrarily changed and processed. Please understand.

100 コンピュータ
101 処理装置
102 システムバス
103 メモリ
104 入力装置
105 出力装置
106 通信制御装置
107 記憶装置
110 差分抽出システム
111 構文解析手段
112 ネスト情報解析手段
113 差分抽出手段
114 差分解析手段
115 設計書生成手段
121 ソースコードデータ記憶部
122 抽象構文木データ記憶部
123 ネスト・構文要素TSVデータ記憶部
124 差分抽出データ記憶部
125 差分解析データ記憶部
126 設計書データ記憶部
127 構文解析データ記憶部
128 構文変換データ記憶部
901 旧ソースコードの抽象構文木データ
1001 新ソースコードの抽象構文木データ
1101 旧ソースコードのネスト・構文要素TSV
1201 新ソースコードのネスト・構文要素TSV
1301 差分抽出結果データ
1801 差分解析結果データ
2001 予約語−日本語変換テーブル
2101 本文出力部
2102 変更区分出力部
DESCRIPTION OF SYMBOLS 100 Computer 101 Processing apparatus 102 System bus 103 Memory 104 Input apparatus 105 Output apparatus 106 Communication control apparatus 107 Storage apparatus 110 Difference extraction system 111 Syntax analysis means 112 Nest information analysis means 113 Difference extraction means 114 Difference analysis means 115 Design document generation means 121 Source code data storage unit 122 Abstract syntax tree data storage unit 123 Nested / syntax element TSV data storage unit 124 Difference extraction data storage unit 125 Difference analysis data storage unit 126 Design document data storage unit 127 Syntax analysis data storage unit 128 Syntax conversion data storage unit Part 901 Abstract syntax tree data of old source code 1001 Abstract syntax tree data of new source code 1101 Nest and syntax element TSV of old source code
1201 New source code nesting and syntax elements TSV
1301 Difference extraction result data 1801 Difference analysis result data 2001 Reserved word-Japanese conversion table 2101 Text output unit 2102 Change classification output unit

Claims (7)

変更前後のソースコードを構文解析し差分を抽出するコンピュータ装置であって、前記コンピュータ装置は、
変更前後のソースコードに含まれる予約語に基づき構文解析を行い、前記変更前後のソースコードの各々に対して、前記予約語をノードとする抽象構文木データを生成する構文解析手段と、
前記生成した抽象構文木データの木構造データの深さに基づきネスト情報の解析を行い、前記変更前後のソースコードの各々に対して、ネスト構文要素データを生成するネスト情報解析手段と、
前記生成したネスト構文要素データの各々の比較に基づき、差分抽出データを生成する差分抽出手段であって、前記差分抽出データは、前記変更前後のソースコードにおいて変更があったことを示す第1の差分識別子を含む、差分抽出手段と、
少なくとも一致判別ルールと条件追加・削除抽出ルールとに基づき前記生成した差分抽出データを解析し、差分解析データを生成する差分解析手段であって、前記差分解析データは、変更前後の変更がどのような変更かを示す第2の差分識別子、ならびに変更前後の予約語と、非予約語と、ネスト数と、行番号とを変更前後の行単位で対応して有し、前記第2の差分識別子は、前記第1の差分識別子と比較して、少なくとも、変更前後の変更内容が条件文の条件の追加、または削除であることを多く示すことができ、前記差分解析データを生成することは、
前記一致判別ルールに従った解析として、前記生成した差分抽出データのうちの、変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の行として一致するか否かを判定すること
を含む、差分解析手段と
を備えたことを特徴とするコンピュータ装置。
A computer device that parses the source code before and after the change and extracts a difference, the computer device comprising:
Syntactic analysis based on reserved words included in the source code before and after the change, and for each of the source codes before and after the change, syntax analysis means for generating abstract syntax tree data having the reserved word as a node;
Nest information analysis means for analyzing nest information based on the tree structure data depth of the generated abstract syntax tree data, and generating nested syntax element data for each of the source code before and after the change,
Difference extraction means for generating difference extraction data based on the comparison of each of the generated nested syntax element data , wherein the difference extraction data indicates a change in the source code before and after the change. A difference extraction means including a difference identifier ;
A difference analysis means for analyzing the generated difference extraction data based on at least a match determination rule and a condition addition / deletion extraction rule and generating difference analysis data, wherein the difference analysis data is changed before and after the change. A second difference identifier indicating whether the change is made, a reserved word before and after the change, a non-reserved word, a nest number, and a row number corresponding to each other before and after the change, and the second difference identifier Compared with the first difference identifier, at least, it is possible to indicate that the change content before and after the change is addition or deletion of a condition of a conditional statement, and generating the difference analysis data
As an analysis according to the match determination rule, in the generated difference extraction data, the lines before and after the change are matched according to the degree of matching between the reserved words and the non-reserved words corresponding to the lines before and after the change. And a difference analysis means including determining whether or not the computer apparatus.
前記差分解析データを生成することは、
前記条件追加・削除抽出ルールに従った解析として、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の変更が条件文の条件の追加、または削除であるか否かを判定すること
をさらに含むことを特徴とする請求項1に記載のコンピュータ装置。
Generating the differential analysis data includes
As an analysis according to the condition addition / deletion extraction rule, each of the reserved word and the non-reserved word corresponding to the line before and after the change when it is determined as a line before and after the change in the analysis according to the match determination rule The computer apparatus according to claim 1, further comprising: determining whether the change before and after the change is an addition or deletion of a condition of a conditional sentence according to a degree of matching between the two.
前記差分解析データを生成することは、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行のネスト数を比較して、字上げまたは字下げが発生しているか否かを判定することをさらに含み、前記第2の差分識別子は、前記第1の差分識別子と比較して、変更前後の変更内容が字上げまたは字下げであることをさらに示すことができることを特徴とする請求項1または2に記載のコンピュータ装置。   The generation of the difference analysis data is performed by comparing the number of nests of the lines before and after the change when it is determined that the lines before and after the change match in the analysis according to the match determination rule. Further comprising determining whether or not it occurs, wherein the second difference identifier further indicates that the change content before and after the change is indentation or indentation compared to the first difference identifier. The computer apparatus according to claim 1, wherein the computer apparatus can be used. 前記コンピュータ装置は、前記生成した差分解析データと前記生成した変更前のソースコードに対するネスト構文要素データを設計書用文言に変換し、設計書データを生成する設計書生成手段であって、前記設計書データは、変更前後の変更内容を、変更前後の行単位で対応して有する、設計書生成手段をさらに備えたことを特徴とする請求項1乃至3のいずれか一項に記載のコンピュータ装置。   The computer device is a design document generation unit that converts the generated differential analysis data and the generated nested syntax element data for the source code before the change into a text for design document, and generates design document data. The computer apparatus according to any one of claims 1 to 3, further comprising a design document generation unit that has the contents of the change before and after the change in line units before and after the change. . 前記設計書データは、前記変更前後の変更内容を修飾表示するためのデータと、前記変更前後の変更内容をハイライト表示するためのデータとをさらに有することを特徴とする請求項4に記載のコンピュータ装置。   The said design document data further has the data for carrying out the modification display of the change content before and behind the said change, and the data for highlighting the change content before and after the said change, The Claim 4 characterized by the above-mentioned. Computer device. 変更前後のソースコードを構文解析し差分を抽出し、設計書データを生成するコンピュータ実行方法であって、前記コンピュータ実行方法は、
変更前後のソースコードに含まれる予約語に基づき構文解析を行い、前記変更前後のソースコードの各々に対して、前記予約語をノードとする抽象構文木データを生成するステップと、
前記生成した抽象構文木データの木構造データの深さに基づきネスト情報の解析を行い、前記変更前後のソースコードの各々に対して、ネスト構文要素データを生成するステップと、
前記生成したネスト構文要素データの各々の比較に基づき、差分抽出データを生成するステップであって、前記差分抽出データは、前記変更前後のソースコードにおいて変更があったことを示す第1の差分識別子を含む、生成するステップと、
少なくとも一致判別ルールと条件追加・削除抽出ルールとに基づき前記生成した差分抽出データを解析し、差分解析データを生成するステップであって、前記差分解析データは、変更前後の変更がどのような変更かを示す第2の差分識別子、ならびに変更前後の予約語と、非予約語と、ネスト数と、行番号とを変更前後の行単位で対応して有し、前記第2の差分識別子は、前記第1の差分識別子と比較して、少なくとも、変更前後の変更内容が条件文の条件の追加、削除、字上げ、または字下げであることを多く示すことができ、前記差分解析データを生成するステップは、
前記一致判別ルールに従った解析として、前記生成した差分抽出データのうちの、変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の行として一致するか否かを判定するステップと、
前記条件追加・削除抽出ルールに従った解析として、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の変更が条件文の条件の追加、または削除であるか否かを判定するステップと、
前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行のネスト数を比較して、字上げまたは字下げが発生しているか否かを判定するステップと
を含む、生成するステップと、
前記生成した差分解析データと前記生成した変更前のソースコードに対するネスト構文要素データを設計書用文言に変換し、設計書データを生成するステップであって、前記設計書データは、変更前後の変更内容を、変更前後の行単位で対応して有する、生成するステップと
を備えたことを特徴とするコンピュータ実行方法。
A computer-implemented method for parsing source code before and after the change, extracting differences, and generating design document data, the computer-executed method comprising:
Performing syntax analysis based on reserved words included in the source code before and after the change, and generating abstract syntax tree data having the reserved word as a node for each of the source codes before and after the change;
Analyzing the nested information based on the tree structure data depth of the generated abstract syntax tree data, and generating nested syntax element data for each of the source code before and after the change;
A step of generating difference extraction data based on each comparison of the generated nested syntax element data , wherein the difference extraction data is a first difference identifier indicating that there is a change in the source code before and after the change Generating, including :
Analyzing the generated difference extraction data based on at least the match determination rule and the condition addition / deletion extraction rule, and generating difference analysis data, the difference analysis data being changed before and after the change. And a reserved word before and after the change, a non-reserved word, a nesting number, and a row number corresponding to each other before and after the change, and the second difference identifier is: Compared with the first difference identifier, at least the change contents before and after the change can indicate more that the condition sentence condition is added, deleted, indented, or indented, and the difference analysis data is generated The steps to do are
As an analysis according to the match determination rule, in the generated difference extraction data, the lines before and after the change are matched according to the degree of matching between the reserved words and the non-reserved words corresponding to the lines before and after the change. Determining whether or not,
As an analysis according to the condition addition / deletion extraction rule, each of the reserved word and the non-reserved word corresponding to the line before and after the change when it is determined as a line before and after the change in the analysis according to the match determination rule Determining whether or not the change before and after the change is the addition or deletion of a condition in the conditional statement according to the degree of matching between each other;
A step of determining whether or not indentation or indentation has occurred by comparing the number of nests of the lines before and after the change when it is determined that the lines match before and after the change in the analysis according to the match determination rule Generating steps including and
The generated differential analysis data and the generated nested syntax element data for the source code before the change are converted into a design document word, and a design document data is generated, wherein the design document data is changed before and after the change. A computer-implemented method comprising: a step of generating contents corresponding to each line before and after the change.
変更前後のソースコードを構文解析し差分を抽出し、設計書データを生成するコンピュータ実行方法をコンピュータに実行させるためのコンピュータ実行可能命令からなるコンピュータプログラムであって、前記コンピュータ実行方法は、
変更前後のソースコードに含まれる予約語に基づき構文解析を行い、前記変更前後のソースコードの各々に対して、前記予約語をノードとする抽象構文木データを生成するステップであって、前記抽象構文木データは、前記予約語をノードとする木構造データであり、前記予約語と、前記予約語に対応する非予約語と、前記予約語を含む行を示す行番号データとを有する、生成するステップと、
前記生成した抽象構文木データの木構造データの深さに基づきネスト情報の解析を行い、前記変更前後のソースコードの各々に対して、ネスト構文要素データを生成するステップと、
前記生成したネスト構文要素データの各々の比較に基づき、差分抽出データを生成するステップであって、前記差分抽出データは、前記変更前後のソースコードにおいて変更があったことを示す第1の差分識別子を含む、生成するステップと、
少なくとも一致判別ルールと条件追加・削除抽出ルールとに基づき前記生成した差分抽出データを解析し、差分解析データを生成するステップであって、前記差分解析データは、変更前後の変更がどのような変更かを示す第2の差分識別子、ならびに変更前後の予約語と、非予約語と、ネスト数と、行番号とを変更前後の行単位で対応して有し、前記第2の差分識別子は、前記第1の差分識別子と比較して、少なくとも、変更前後の変更内容が条件文の条件の追加、削除、字上げ、または字下げであることを多く示すことができ、前記差分解析データを生成するステップは、
前記一致判別ルールに従った解析として、前記生成した差分抽出データのうちの、変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の行として一致するか否かを判定するステップと、
前記条件追加・削除抽出ルールに従った解析として、前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行で対応する予約語および非予約語の各々同士の一致度合いに応じて、変更前後の変更が条件文の条件の追加、または削除であるか否かを判定するステップと、
前記一致判別ルールに従った解析において変更前後の行として一致すると判定された場合、前記変更前後の行のネスト数を比較して、字上げまたは字下げが発生しているか否かを判定するステップと
を含む、生成するステップと、
前記生成した差分解析データと前記生成した変更前のソースコードに対するネスト構文要素データを設計書用文言に変換し、設計書データを生成するステップであって、前記設計書データは、変更前後の変更内容を、変更前後の行単位で対応して有する、生成するステップと
を備えたことを特徴とするコンピュータプログラム。
A computer program comprising computer-executable instructions for causing a computer to execute a computer execution method for parsing source code before and after change, extracting a difference, and generating design document data, the computer execution method comprising:
Performing a syntax analysis based on reserved words included in the source code before and after the change, and generating abstract syntax tree data having the reserved word as a node for each of the source codes before and after the change, the abstract code The syntax tree data is tree structure data having the reserved word as a node, and includes the reserved word, a non-reserved word corresponding to the reserved word, and line number data indicating a line including the reserved word. And steps to
Analyzing the nested information based on the tree structure data depth of the generated abstract syntax tree data, and generating nested syntax element data for each of the source code before and after the change;
A step of generating difference extraction data based on each comparison of the generated nested syntax element data , wherein the difference extraction data is a first difference identifier indicating that there is a change in the source code before and after the change Generating, including :
Analyzing the generated difference extraction data based on at least the match determination rule and the condition addition / deletion extraction rule, and generating difference analysis data, the difference analysis data being changed before and after the change. And a reserved word before and after the change, a non-reserved word, a nesting number, and a row number corresponding to each other before and after the change, and the second difference identifier is: Compared with the first difference identifier, at least the change contents before and after the change can indicate more that the condition sentence condition is added, deleted, indented, or indented, and the difference analysis data is generated The steps to do are
As an analysis according to the match determination rule, in the generated difference extraction data, the lines before and after the change are matched according to the degree of matching between the reserved words and the non-reserved words corresponding to the lines before and after the change. Determining whether or not,
As an analysis according to the condition addition / deletion extraction rule, each of the reserved word and the non-reserved word corresponding to the line before and after the change when it is determined as a line before and after the change in the analysis according to the match determination rule Determining whether or not the change before and after the change is the addition or deletion of a condition in the conditional statement according to the degree of matching between each other;
A step of determining whether or not indentation or indentation has occurred by comparing the number of nests of the lines before and after the change when it is determined that the lines match before and after the change in the analysis according to the match determination rule Generating steps including and
The generated differential analysis data and the generated nested syntax element data for the source code before the change are converted into a design document word, and a design document data is generated, wherein the design document data is changed before and after the change. A computer program comprising: a step of generating contents corresponding to each line before and after the change.
JP2012131974A 2012-06-11 2012-06-11 Source code difference extraction method and system using parsing Active JP6022815B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012131974A JP6022815B2 (en) 2012-06-11 2012-06-11 Source code difference extraction method and system using parsing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012131974A JP6022815B2 (en) 2012-06-11 2012-06-11 Source code difference extraction method and system using parsing

Publications (2)

Publication Number Publication Date
JP2013257639A JP2013257639A (en) 2013-12-26
JP6022815B2 true JP6022815B2 (en) 2016-11-09

Family

ID=49954053

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012131974A Active JP6022815B2 (en) 2012-06-11 2012-06-11 Source code difference extraction method and system using parsing

Country Status (1)

Country Link
JP (1) JP6022815B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7306026B2 (en) * 2019-04-01 2023-07-11 カシオ計算機株式会社 Program for converting program, information processing apparatus, and information processing method
CN115167834B (en) * 2022-09-08 2022-12-23 杭州新中大科技股份有限公司 Automatic source code generation method and device based on code datamation
CN116302089B (en) * 2023-05-23 2023-08-18 华中科技大学 Picture similarity-based code clone detection method, system and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04165425A (en) * 1990-10-29 1992-06-11 Nippon Telegr & Teleph Corp <Ntt> Method and device for extracting nesting relation in symbol string
JPH05143351A (en) * 1991-11-22 1993-06-11 Nec Corp Source program comparing system

Also Published As

Publication number Publication date
JP2013257639A (en) 2013-12-26

Similar Documents

Publication Publication Date Title
CN104899010B (en) The multi-lingual opinion on public affairs method and system of source code
US9690788B2 (en) File type recognition analysis method and system
CA3088692A1 (en) Visualizing comment sentiment
US9811449B2 (en) Test scenario generation support device and test scenario generation support method
CN102339252A (en) Static state detecting system based on XML (Extensive Makeup Language) middle model and defect mode matching
US10049032B2 (en) Methods for generating a negative test input data and devices thereof
Hamza et al. Generating UML use case models from software requirements using natural language processing
US20190272324A1 (en) Language model, method and apparatus for interpreting zoning legal text
KR20120051419A (en) Apparatus and method for extracting cascading style sheet
JP4815934B2 (en) Text mining device, text mining method, text mining program
JP6022815B2 (en) Source code difference extraction method and system using parsing
CN113792027B (en) General database conversion device
CN103761095A (en) Method for generating universal header data information of upgraded file
JP2010061176A (en) Text mining device, text mining method, and text mining program
CN102707938B (en) Table-form software specification manufacturing and supporting method and device
JP2008112363A (en) Document processor and document processing program
CN115599388A (en) API (application programming interface) document generation method, storage medium and electronic equipment
US11416246B2 (en) Information processing apparatus, analysis system, analysis method, and non-transitory computer readable medium storing analysis program
CN115579096A (en) Automatic generation and analysis verification method, system and storage medium for drug alert E2B R3 standard report
US10120652B2 (en) System and method for representing software development requirements into standard diagrams
JP2013218507A (en) Structure analyzer and program
Singh et al. pyTLEX: A Python Library for TimeLine EXtraction
JP4387324B2 (en) Property conversion device
US20240004620A1 (en) Automated generation of web applications based on wireframe metadata generated from user requirements
US20230251857A1 (en) Development support device, non-transitory computer-readable medium, and development support method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150608

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160212

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160223

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160418

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160913

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20161006

R150 Certificate of patent or registration of utility model

Ref document number: 6022815

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350