JP2009054125A - Document information display system - Google Patents

Document information display system Download PDF

Info

Publication number
JP2009054125A
JP2009054125A JP2007248057A JP2007248057A JP2009054125A JP 2009054125 A JP2009054125 A JP 2009054125A JP 2007248057 A JP2007248057 A JP 2007248057A JP 2007248057 A JP2007248057 A JP 2007248057A JP 2009054125 A JP2009054125 A JP 2009054125A
Authority
JP
Japan
Prior art keywords
grammar
state
document
character string
display
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.)
Abandoned
Application number
JP2007248057A
Other languages
Japanese (ja)
Inventor
Daisuke Kamiyama
大輔 上山
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to JP2007248057A priority Critical patent/JP2009054125A/en
Publication of JP2009054125A publication Critical patent/JP2009054125A/en
Abandoned legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To analyze the grammar of a document and display acquired information without passing through a compiler linker using a grammar description file which a user can customize. <P>SOLUTION: The state of each character of the document is determined, and the information acquired from the state of each character is displayed, based on a state transition rule consisting of a plurality of ästate-character string-state transition destination in matching of character string} created in order to express the grammar of the document. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、文書情報表示システムに関する。  The present invention relates to a document information display system.

従来、テキストエディタにおいて、エディタ内に組み込まれた文法情報に従って色付けしたり、正規表現に一致した部分や行を色付けしたり、キーワードを色付けしたりする機能がある。また、統合開発環境(IDE)において、コンパイラ・リンカから取得した識別子情報に基づいて色付けや補完入力する機能がある。  Conventionally, a text editor has a function of coloring according to grammatical information incorporated in the editor, coloring a part or line that matches a regular expression, or coloring a keyword. In addition, in the integrated development environment (IDE), there is a function of coloring or complementing input based on identifier information acquired from the compiler / linker.

文書編集システムや文書参照システムにおいて、文法情報に基づいた色付けや補完入力や付加情報の表示は、文書作成の品質・効率向上に有用である。しかし、従来のシステムでは、もっとより多くの情報や、より自由なカスタマイズ性が欲しいことがある。また、専用の環境でのコンパイル・リンクを必要とする場合、移行のコストやリスクを必要としたり、対象外の言語では使用できなかったりする課題がある。  In document editing systems and document reference systems, coloring based on grammatical information, complementary input, and display of additional information are useful for improving the quality and efficiency of document creation. However, traditional systems may want more information and more customizability. In addition, when compiling and linking in a dedicated environment is required, there are problems such as requiring the cost and risk of migration and being unable to use in a language that is not the target.

本発明は、ユーザーがカスタマイズ可能な文法記述ファイルを用いて、コンパイラ・リンカを通すことなく、文書の文法を解析し、得られる情報を表示することを目的とするものである。  SUMMARY OF THE INVENTION An object of the present invention is to analyze a document grammar and display information obtained by using a grammar description file that can be customized by a user without passing through a compiler / linker.

この課題を解決するための請求項1の発明は、図1のように構成されるシステムである。図1において、1は文法記憶手段であり、文書の文法を表現する目的で作成された、複数個の{状態・文字列・文字列一致時の状態遷移先}からなる状態遷移ルールを記憶する。  The invention of claim 1 for solving this problem is a system configured as shown in FIG. In FIG. 1, reference numeral 1 denotes grammar storage means for storing a state transition rule made up of a plurality of {state, character string, state transition destination when matching character strings} created for the purpose of expressing the grammar of a document. .

2は文書であり、解析の対象である。  Reference numeral 2 denotes a document, which is an object of analysis.

3は文法解析・記憶手段であり、文法記憶手段1に記憶された状態遷移ルールに従って、文書2の各文字の状態を決定し記憶する。  Reference numeral 3 denotes grammar analyzing / storing means, which determines and stores the state of each character of the document 2 in accordance with the state transition rules stored in the grammar storing means 1.

4は表示手段であり、文法解析・記憶手段3で決定された各文字の状態から得られる情報を表示する。  Reference numeral 4 denotes display means for displaying information obtained from the state of each character determined by the grammar analysis / storage means 3.

文法解析・記憶手段3における、各文字の状態決定の手順は以下のとおりである。  The procedure for determining the state of each character in the grammar analyzing / storing means 3 is as follows.

文法解析・記憶手段3は、文書内の文字の位置を記憶するポインタと、現在の状態を記憶する状態変数を持つ。処理の最初において、ポインタは文書の最初にあり、状態変数は初期状態である。文法解析・記憶手段3は、まず、文法記憶手段1の状態遷移ルールから、「状態」が状態変数と一致し、かつ、「文字列」がポインタ以降の文字列と一致するものを検索する。一致するものがあったら、その状態遷移ルールの「文字列一致時の状態遷移先」を新たな状態遷移先として状態変数へ設定する。そして、ポインタを進め、旧ポインタと新ポインタの間の文字の状態を、状態変数に記憶された状態で決定し、記憶する。以上の処理を、ポインタが文書の最後に到達するまで繰り返す。  The grammar analysis / storage means 3 has a pointer for storing the position of the character in the document and a state variable for storing the current state. At the beginning of processing, the pointer is at the beginning of the document and the state variables are in the initial state. The grammar analysis / storage unit 3 first searches the state transition rule of the grammar storage unit 1 for a case where “state” matches a state variable and “character string” matches a character string after the pointer. If there is a match, the state transition rule “state transition destination when matching character strings” is set as a new state transition destination in the state variable. Then, the pointer is advanced, and the state of the character between the old pointer and the new pointer is determined and stored in the state stored in the state variable. The above processing is repeated until the pointer reaches the end of the document.

本発明により、ユーザーがカスタマイズ可能な文法記述ファイルを用いて、コンパイラ・リンカを通すことなく、文書の文法を解析し、得られる情報を表示することができる。  According to the present invention, a user-customizable grammar description file can be used to analyze document grammar and display information obtained without passing through a compiler / linker.

統合開発環境を新規に導入する場合に比べ、コンパイラやリンカを通す必要がなく、現在使用中の開発環境はそのまま使用することが出来るため、移行コストやリスクを必要としない。  Compared to the case of newly introducing an integrated development environment, it is not necessary to pass through a compiler or linker, and the development environment currently in use can be used as it is, so there is no need for migration costs and risks.

また、文法をユーザーがカスタマイズして使用することが出来るため、メジャーではないプログラミング言語であっても使用することが出来る。さらに、静的解析機能や統合開発環境を持たない言語であっても、本発明によって得られる情報を元にしたチェック機能や警告表示機能等を使用することが出来る。  Moreover, since the grammar can be customized by the user, it can be used even with programming languages that are not major. Furthermore, even in a language that does not have a static analysis function or an integrated development environment, a check function or a warning display function based on information obtained by the present invention can be used.

以下、本発明の実施の形態を図2〜図11に基づき説明する。図2は本発明の実施の形態の構成図、図3は文法記述ファイルの基本文法、図4は状態遷移動作の例、図5は文法解析変数設定動作の例、図6は識別子記憶動作・関数コール箇所記憶動作の例、図7は制御構造記憶動作の例、図8はソース解析支援動作の例、図9は警告情報表示の文法記述ファイル記述例、図10は1:1対応チェックの文法記述ファイル記述例、図11はC言語用の文法記述ファイルの例である。  Hereinafter, embodiments of the present invention will be described with reference to FIGS. 2 is a configuration diagram of an embodiment of the present invention, FIG. 3 is a basic grammar of a grammar description file, FIG. 4 is an example of a state transition operation, FIG. 5 is an example of a grammar analysis variable setting operation, and FIG. 7 is an example of a function call location storage operation, FIG. 7 is an example of a control structure storage operation, FIG. 8 is an example of a source analysis support operation, FIG. 9 is a description example of a grammar description file for displaying warning information, and FIG. FIG. 11 shows an example of a grammar description file description for C language.

図2において、1a,1bは文法記述ファイル、1cは文法記述データ、2は文書、3は文法解析・記憶手段、4は表示手段である。なお、本文書情報表示システムは、文書編集システムや文書参照システム内に組み込まれる。  In FIG. 2, 1a and 1b are grammar description files, 1c is grammar description data, 2 is a document, 3 is grammar analysis / storage means, and 4 is display means. The document information display system is incorporated in a document editing system or a document reference system.

文法記述ファイルは、図3のような仕様で、複数個の{状態・条件文字列・条件文字列一致時に行う動作の配列}からなるルールを記憶したファイルである。  The grammar description file is a file that stores a plurality of rules consisting of {arrangement of operations performed when a state / condition character string / condition character string matches} with specifications as shown in FIG.

1つの状態は、複数のstate[状態名]{・・・}構文に分けて記述することが出来る。また、状態名に*を記述した場合は任意の状態を表し、全ての状態に共通のルールであることを示す。[状態名]に複数の状態名をカンマで区切って記述することも可能であり、その場合はその複数の状態に共通のルールであることを示す。  One state can be described by dividing it into a plurality of state [state name] {. When * is described in the state name, it represents an arbitrary state and indicates that the rule is common to all states. It is possible to describe a plurality of state names in [State Name] by separating them with commas, and in this case, the rules are common to the plurality of states.

条件文字列として、正規表現も記述可能であり、その場合は、ダブルクオーテーションの前にRを記述し、例えばR“[a−z]+”のように記述する。  A regular expression can also be described as a conditional character string. In this case, R is described before double quotation, for example, R “[az] +”.

文法記述ファイルは複数のファイルに分けて記述することが出来る。図2では2つのファイルとして記述されているが、3つ以上でも構わない。プロジェクトごとや、チームごと、担当者ごとに、ファイルを追加することが出来る。追加したファイルでは、文法構造を大きく変更することは出来ないが、少なくとも、後述する警告情報表示やチェックのためのルールを追加することが出来る。これにより、例えば、不具合発生時の再発防止策として、警告情報表示やチェックのルールを追加する、といった使い方が出来る。  The grammar description file can be described in multiple files. Although two files are described in FIG. 2, three or more files may be used. Files can be added for each project, team, and person in charge. In the added file, the grammatical structure cannot be changed greatly, but at least a rule for warning information display and check described later can be added. As a result, for example, a warning information display or a check rule can be added as a measure for preventing a recurrence when a problem occurs.

システムは、複数の文法記述ファイルを読み込み、状態ごとにマージして、文法記述データ1cとしてメモリ内に記憶する。  The system reads a plurality of grammar description files, merges them for each state, and stores them in the memory as grammar description data 1c.

次に、文法解析・記憶手段3は、以下に記載した手順で、文書2の文法を解析し、文字ごとに状態を決定していく。  Next, the grammar analyzing / storing unit 3 analyzes the grammar of the document 2 and determines the state for each character according to the procedure described below.

文法解析・記憶手段3は、文書内の文字の位置を記憶するポインタと、現在の状態を記憶する状態変数を持つ。処理の最初において、ポインタは文書の最初にあり、状態変数は初期状態である。文法記述データ1c内で、状態名が「idle」である状態を初期状態とする。  The grammar analysis / storage means 3 has a pointer for storing the position of the character in the document and a state variable for storing the current state. At the beginning of processing, the pointer is at the beginning of the document and the state variables are in the initial state. A state in which the state name is “idle” in the grammar description data 1c is set as an initial state.

文法記述データ1cから、現在の状態の条件文字列を検索し、文書の現在のポインタ以降の文字列と一致するものを見つける。各条件文字列の長さ分だけ一致していれば、一致とみなす。  From the grammar description data 1c, the condition character string in the current state is searched, and the character string after the current pointer of the document is found. If the length of each condition character string matches, it is considered a match.

一致する条件文字列が見つかった場合は、その条件文字列に対応する動作を順に実行し、条件文字列の長さ分だけポインタを進める。旧ポインタと新ポインタの間の文字の状態は、状態変数に格納された状態で決定される。ただし、実行される動作によっては、ポインタを進める前もしくは後に、状態変数が変更される。  If a matching condition character string is found, operations corresponding to the condition character string are executed in order, and the pointer is advanced by the length of the condition character string. The state of the character between the old pointer and the new pointer is determined by the state stored in the state variable. However, depending on the operation to be performed, the state variable is changed before or after the pointer is advanced.

一致する条件文字列が見つからない場合は、一単語分もしくは一記号分ポインタを進める。旧ポインタと新ポインタの間の文字の状態は、状態変数に格納された状態で決定される。  If no matching condition character string is found, the pointer is advanced by one word or one symbol. The state of the character between the old pointer and the new pointer is determined by the state stored in the state variable.

一致する条件文字列が見つからない場合でも、文法記述ファイルに条件文字列としてdefaultが記述されている場合は、それに一致したものとみなす。  Even if a matching condition character string is not found, if default is described as a condition character string in the grammar description file, it is regarded as a match.

図4は、文法記述ファイルに記述される動作のうち、状態遷移動作の例である。例えば、「ChangeState(x) 」は、状態変数の状態をxに変更してから、ポインタを進める。「ChangeStateFromNextChar(x) 」は、ポインタを進めてから、状態変数の状態をxに変更する。「PushState(x) 」は現在の状態を保存し、状態変数の状態をxに変更してから、ポインタを進める。「PopState」は状態変数の状態を、PushStateで保存された状態に変更してから、ポインタを進める。  FIG. 4 is an example of a state transition operation among the operations described in the grammar description file. For example, “ChangeState (x)” changes the state of the state variable to x and then advances the pointer. “ChangeStateFromNextChar (x)” advances the pointer and then changes the state of the state variable to x. “PushState (x)” saves the current state, changes the state variable state to x, and then advances the pointer. “PopState” changes the state of the state variable to the state stored in PushState, and then advances the pointer.

さらに、文法解析・記憶手段3は、文書内の文字列の内容と位置を記憶するための変数(以下、文法解析変数と記述する)を持つ。また、文書内の解析済みのトークン(トークンとは1つの単語や記号のことである)の内容と位置を順に記憶する配列(以下、トークンスタックと記述する)を持つ。なお、これらは、概念的には文字列の内容と位置を記憶するものであるが、文字列の内容は文書内に存在するので、実装上は、メモリや処理時間の節約のため、文書内の位置だけを記憶すればよい。  Further, the grammar analysis / storage means 3 has a variable (hereinafter referred to as a grammar analysis variable) for storing the contents and position of the character string in the document. Also, it has an array (hereinafter referred to as a token stack) that sequentially stores the contents and position of analyzed tokens (a token is one word or symbol) in a document. Note that these conceptually store the contents and position of the character string, but the contents of the character string exist in the document. Therefore, in order to save memory and processing time, they are stored in the document. It is only necessary to memorize the position of.

文法解析変数には、図5記載の動作「SetVar〜」によって文字列の内容と位置が記憶される。例えば、動作「SetVarStart(x) 」が実行された位置から、動作「SetVarEnd(x) 」が実行された位置までの文字列が、文法解析変数に記憶される。  In the grammatical analysis variable, the contents and position of the character string are stored by the operation “SetVar˜” described in FIG. For example, a character string from the position where the operation “SetVarStart (x)” is executed to the position where the operation “SetVarEnd (x)” is executed is stored in the grammar analysis variable.

また、動作「SetVarWithTokenStack」により、トークンスタック内の指定文字列が、文法解析変数へコピーされる。  In addition, the designated character string in the token stack is copied to the grammar analysis variable by the operation “SetVarWithTokenStack”.

文法解析変数に格納された文字列は、例えば図6記載の動作「AddIdentifier」により、関数や変数等の識別子の名前として、文法解析・記憶手段3に記憶させることが出来る。  The character string stored in the grammar analysis variable can be stored in the grammar analysis / storage unit 3 as an identifier name of a function, a variable, or the like, for example, by the operation “AddIdentifier” illustrated in FIG.

さらに、文法解析・記憶手段3は、行ごとに、行開始位置の状態、「PushState(x) 」により保存された状態、その行で記憶された識別子の情報を記憶する。  Further, the grammar analysis / storage unit 3 stores, for each line, the state of the line start position, the state saved by “PushState (x)”, and the identifier information stored in the line.

文書を編集したときは、編集を行った行を再度文法解析する。ただし、文法解析変数やトークンスタックを再構成する必要があるため、行開始位置の状態が初期状態である行までさかのぼって文法解析を開始し、行開始位置の状態が編集前の状態と同じになる行で文法解析を終了する。  When the document is edited, the edited line is analyzed again. However, since it is necessary to reconfigure the grammar analysis variable and token stack, grammar analysis is started by going back to the line where the line start position is in the initial state, and the line start position is the same as before editing. The grammar analysis ends with

最後に、表示手段4は、文字ごとの状態から得られる情報を表示する。例えば、コメント部分の文字を赤色で表示する。  Finally, the display means 4 displays information obtained from the state for each character. For example, the characters in the comment part are displayed in red.

さらに、表示手段4は、図6、図7、図8に記載の動作によって文法解析・記憶手段3に記憶された情報を元に、様々な情報の表示や文書のチェック結果を表示することが出来る。以下、図6、図7、図8に記載の動作ごとに説明する。  Further, the display unit 4 can display various information and document check results based on the information stored in the grammar analysis / storage unit 3 by the operations described in FIGS. 6, 7, and 8. I can do it. Hereinafter, each operation described in FIGS. 6, 7, and 8 will be described.

図6記載の動作「AddIdentifier」により、文法解析・記憶手段3は、文法解析変数に格納された文字列を、関数・変数等の識別子の名前や、付加情報や、型名として記憶し、さらに、識別子名の位置を記憶する。また、2つの関数の名前の位置の間を関数の定義位置とみなすことにより、各関数の定義位置情報を得ることが出来る。これにより、表示手段4は、以下の情報を表示することが出来る。    By the operation “AddIdentifier” illustrated in FIG. 6, the grammar analysis / storage unit 3 stores the character string stored in the grammar analysis variable as the name of an identifier such as a function / variable, additional information, or a type name. The position of the identifier name is stored. Further, by regarding the position between the positions of the names of two functions as the function definition position, the definition position information of each function can be obtained. Thereby, the display means 4 can display the following information.

・文書表示画面上で、関数名や変数名等の識別子の名前を色付けして表示したり、文書内の関数名や変数名等の識別子の名前を一覧表示する。また、識別子名の最初の数文字を入力することで、後の文字を自動補完して入力することが出来るようにする。  -Color and display identifier names such as function names and variable names on the document display screen, or display a list of identifier names such as function names and variable names in the document. In addition, by inputting the first few characters of the identifier name, the subsequent characters can be automatically complemented and input.

・文書表示画面上で、関数名や変数名等の識別子の名前部分をクリックしたり、選択したり、キーボード入力したりすることにより、そのカテゴリー名(関数、変数等の種類)や付加情報(引数等)や型名を表示する。また、関数の定義や宣言の内容を表示する。  -On the document display screen, clicking the name part of an identifier such as a function name or variable name, selecting it, or entering it on the keyboard, its category name (type of function, variable, etc.) and additional information ( Argument) and type name. It also displays the contents of function definitions and declarations.

図6記載の動作「FunctionCall」により、文法解析・記憶手段3は、関数コールの存在箇所とその関数名を記憶する。さらに、同一プロジェクト内の全ての文書を解析することにより、全ての関数の呼び出し箇所と、全ての関数間のコールする/されるの関係情報が得られる。関数の呼び出し箇所がどの関数に含まれているかは、前記動作「AddIdentifier」によって記憶された情報から得ることが出来る。これにより、表示手段4は、以下の情報を表示することが出来る。  By the operation “Function Call” illustrated in FIG. 6, the grammar analysis / storage unit 3 stores the location of the function call and the function name thereof. Further, by analyzing all the documents in the same project, the call location of all functions and the relationship information of calling / calling between all functions can be obtained. The function call location is included in the information stored by the operation “AddIdentifier”. Thereby, the display means 4 can display the following information.

・文書表示画面上で現在選択中の関数について、その関数をコールしている関数名を、コール元方向へさかのぼって表示(バックトレース表示)する。複数のコール元が存在するときは、それらを同時に表示、もしくは、複数のコール元が存在することを示すマークを表示し、ユーザーがそれをクリックすることで他のコール元を表示できるようにする。また、関数名をクリックすることにより、関数の定義や宣言を表示する。  -For the function currently selected on the document display screen, the name of the function calling the function is displayed retroactively (backtrace display). When there are multiple callers, display them at the same time, or display a mark indicating that there are multiple callers, so that the user can click to display other callers . Also, by clicking on the function name, the function definition and declaration are displayed.

・関数のコールする/されるの関係を、表や図で表示する。表や図中の関数名をクリックすると、その関数の定義や宣言を表示する。  -Display the relationship between function calls / calls in tables and diagrams. Click a function name in the table or figure to display the definition and declaration of that function.

・引数の型と仮引数の型を比較し、一致しない場合に、文書表示画面上の関数コール箇所の近傍に警告表示を行う。引数の型と、仮引数の型は、動作「AddIdentifier」により記憶された情報から得ることが出来る。  -Compare the argument type with the formal argument type, and if they do not match, display a warning near the function call location on the document display screen. The type of the argument and the type of the dummy argument can be obtained from the information stored by the operation “AddIdentifier”.

図7記載の動作「ForLoopStart」等により、文法解析・記憶手段3は、プログラムの制御文の種類と位置を記憶する。これにより、表示手段4は、以下の情報を表示することが出来る。  By the operation “ForLoopStart” described in FIG. 7, the grammar analysis / storage unit 3 stores the type and position of the control statement of the program. Thereby, the display means 4 can display the following information.

・制御構造を、フローチャート、PAD図、有向グラフ等で表示する。文書表示画面中のテキストを選択すると、フローチャート等の中の対応する部分を強調表示する。また、フローチャート等の中の一箇所をクリックすると、文書表示画面中のテキストの該当する部分を表示する。  -Display the control structure in a flowchart, PAD diagram, directed graph, etc. When the text on the document display screen is selected, the corresponding part in the flowchart or the like is highlighted. When one place in the flowchart or the like is clicked, the corresponding portion of the text in the document display screen is displayed.

・ソースコード上で、擬似的にデバッガのステップ実行に近い機能を実現する。例えば、擬似ステップイン機能ボタンをクリックすると、現在の選択行にコール関数があればその関数定義を表示し、関数定義の最初の行を選択する。現在の選択行に条件分岐があればどちらに移動するかをユーザーに選択させる。現在の選択行に反復の終了があれば反復を終了するか継続するかをユーザーに選択させる。擬似ステップアウトボタンにより、コール元の行に戻る。さらに、関数コールのバックトレースを表示したり、現在の関数のローカル変数等の識別子情報を表示する。  -Realize functions similar to debugger step execution on the source code. For example, when the pseudo step-in function button is clicked, if there is a call function in the currently selected line, the function definition is displayed, and the first line of the function definition is selected. If there is a conditional branch in the currently selected row, let the user choose which to go to. Lets the user choose to end or continue the iteration if there is an iteration end on the current selection line. Return to the caller's line with the pseudo step-out button. Furthermore, a back trace of the function call is displayed, and identifier information such as a local variable of the current function is displayed.

・文書表示画面上に、制御ルートを矢印で表示する。例えば、アセンブラ言語において、JMP命令の箇所を始点、ジャンプ先のラベルの箇所を終点とする矢印を表示する。  -The control route is displayed with an arrow on the document display screen. For example, in the assembler language, an arrow is displayed with the JMP instruction location as the start point and the jump destination label location as the end point.

・ホワイトボックステストの網羅性をチェックするために、文書表示画面上の条件分岐の箇所の近傍にチェックボックスを表示し、チェックボックスへの記入が出来るようにする。さらに、網羅率を表示する。あらかじめ設定した網羅性の種類(分岐網羅等)によって、チェックボックスの数やタイトルを変える。また、文書内容と、チェックボックスへのチェック記入情報とをひとまとまりにして、テスト結果として、別ファイルへ保存したり、印刷したりできるようにする。  -To check the completeness of the white box test, display a check box near the conditional branch on the document display screen so that the check box can be filled in. In addition, the coverage rate is displayed. The number of check boxes and titles are changed according to the type of coverage (branch coverage, etc.) set in advance. In addition, the contents of the document and the check entry information in the check box are collected together so that the test result can be saved in a separate file or printed.

図8記載の動作「DisplayWarning」により、文法解析・記憶手段3は、警告情報を表示すべき箇所を記憶する。これにより、表示手段4は、文書表示画面の該当箇所に警告情報を表示する。警告情報の表示方法は、まずその部分の背景色を赤色にして表示し、そこを選択したときに警告情報の内容が表示される、などとする。  By the operation “DisplayWarning” illustrated in FIG. 8, the grammar analysis / storage unit 3 stores a portion where warning information is to be displayed. As a result, the display unit 4 displays the warning information at the corresponding location on the document display screen. The warning information is displayed in such a manner that the background color of the portion is first displayed in red and the content of the warning information is displayed when the portion is selected.

さらに、図8記載の動作「DisplayWarningIf」により、文法解析・記憶手段3は、指定された文法解析変数の内容の文字列にフラグが設定されている場合に限り、警告情報を表示すべき箇所を記憶する。  Further, by the operation “DisplayWarningIf” described in FIG. 8, the grammar analysis / storage means 3 changes the location where warning information should be displayed only when a flag is set in the character string of the contents of the designated grammar analysis variable. Remember.

文法解析・記憶手段3は、フラグ設定済み文字列を記憶する配列を持つ。動作「SetFlag」によって、指定された文法解析変数内の文字列が前記配列に追加される。動作「ClearFlag」によって、指定された文法解析変数内の文字列が前記配列から削除される。また、関数定義の境界で前記配列の内容は全て削除される。動作「DisplayWarningIf」により、文法解析・記憶手段3は、指定された文法解析変数の内容の文字列が、前記配列に含まれているかどうかを調べることにより、文字列にフラグが設定されているかどうかを判断する。  The grammar analysis / storage unit 3 has an array for storing a flag-set character string. The character string in the specified grammatical analysis variable is added to the array by the operation “SetFlag”. The character string in the specified grammatical analysis variable is deleted from the array by the operation “ClearFlag”. All the contents of the array are deleted at the function definition boundary. By the operation “DisplayWarningIf”, the grammar analysis / storage unit 3 checks whether or not the character string of the content of the specified grammar analysis variable is included in the array, thereby determining whether or not a flag is set in the character string. Judging.

これにより、例えば、変数を関数に渡す前に変数のレングスチェックが必要であるのに、変数のレングスチェックの記述を忘れてしまったというような場合に、警告情報を表示することが出来る。文法記述ファイルは、図9のように記述し、条件文字列がレングスチェック関数名に一致した場合に動作「SetFlag」を実行し、条件文字列が事前に引数をレングスチェックすべき関数名に一致した場合に動作「DisplayWarningIf」を実行するようにする。  Thus, for example, when it is necessary to check the length of the variable before passing the variable to the function, but the description of the length check of the variable is forgotten, warning information can be displayed. The grammar description file is described as shown in FIG. 9, and when the condition string matches the length check function name, the operation “SetFlag” is executed, and the condition string matches the function name whose length should be checked in advance. In such a case, the operation “DisplayWarningIf” is executed.

図8記載の動作「SymmetricCheckIn」「SymmetricCheckOut」により、文法解析・記憶手段3は、1:1で対応すべき文字列の存在位置と、対応チェックの種類を記憶する。これと、図7記載の動作によって得られた制御構造の情報を使用することにより、表示手段4は、プログラム実行時に1:1対応が取れなくなることがないかをチェックし、チェックエラーがあれば警告を表示することが出来る。  By the operations “SymmetricCheckIn” and “SymmetricCheckOut” illustrated in FIG. 8, the grammar analysis / storage unit 3 stores the existence position of the character string to be corresponding 1: 1 and the type of the correspondence check. By using this and the information of the control structure obtained by the operation shown in FIG. 7, the display means 4 checks whether or not 1: 1 correspondence can not be obtained during program execution, and if there is a check error, A warning can be displayed.

例えば、図10のように文法記述ファイルに記述することで、メモリの割り当て・解放の1:1対応をチェックすることが出来る。文法解析・記憶手段3は、文書中の文字列が条件文字列“malloc”と一致したら、その箇所と、対応チェックの種類“memoryallocate”を記憶する。条件文字列“free”と一致したら、その箇所と、対応チェックの種類“memoryallocate”を記憶する。表示手段4は、対応チェックの種類ごとに、プログラムの制御構造に従っていくつかの制御ルートをトレースし、「SymmetricCheckIn」で記憶された箇所を通った回数と、「SymmetricCheckOut」で記憶された箇所を通った回数が一致しないルートがあれば、1:1対応が取れていないと判断し、警告情報を表示する。  For example, by describing in a grammar description file as shown in FIG. 10, it is possible to check the 1: 1 correspondence of memory allocation / release. When the character string in the document matches the conditional character string “malloc”, the grammar analysis / storage unit 3 stores the location and the type of correspondence check “memoryallocate”. If the condition character string “free” is matched, the location and the type of correspondence check “memorylocate” are stored. The display means 4 traces several control routes according to the control structure of the program for each type of correspondence check, and passes through the location stored in “SymmetricCheckIn” and the location stored in “SymmetricCheckOut”. If there is a route that does not match the number of times, it is determined that 1: 1 correspondence is not achieved, and warning information is displayed.

図8記載の動作「Import」により、文法解析・記憶手段3は、別のファイル(例えばC言語のヘッダファイル)がそこでインポートされていることを記憶する。これにより、表示手段4は、インポートされたファイル、および、インポートされたファイル内でインポートされたファイルを文法解析するようシステムに指示し、得られた識別子の情報等を表示することが出来る。  The operation “Import” shown in FIG. 8 causes the grammar analysis / storage means 3 to store that another file (for example, a C language header file) is imported there. As a result, the display means 4 can instruct the system to analyze the grammar of the imported file and the imported file in the imported file, and can display the obtained identifier information and the like.

図8記載の動作「IncIndent」「DecIndent」により、文法解析・記憶手段3は、各行のインデントレベルを記憶する。最初のインデントレベルは0であり、動作「IncIndent」により+1され、動作「DecIndent」により−1される。文書にはインデント幅情報が保存されており、インデントレベルが+1されると次の行のインデントは現在行より前記インデント幅分だけ右になり、インデントレベルが−1されると次の行のインデントは現在行より前記インデント幅分だけ左になる。  By the operations “IncIndent” and “DecIndent” illustrated in FIG. 8, the grammar analysis / storage unit 3 stores the indent level of each line. The initial indent level is 0, and is incremented by 1 by the operation “IncIndent” and decremented by 1 by the operation “DecIndent”. The indent width information is stored in the document. When the indent level is incremented by 1, the next line is indented to the right by the indent width from the current line. When the indent level is decremented by 1, the next line is indented. Is to the left of the current line by the indent width.

図8記載の動作「LeftValue」「RightValue」により、文法解析・記憶手段3は、代入文の箇所を記憶し、さらに、文法解析変数内の文字列が代入文の左辺値/右辺値であることを記憶する。これにより、表示手段4は、左辺値/右辺値として記憶された文字列を名前とする識別子を検索し、左辺値と右辺値の型が不一致の場合に、文書表示画面上の代入文の箇所の近傍に警告情報を表示することが出来る。これは特に型チェック機能が不十分な言語を使用する場合に有効である。  By the operations “LeftValue” and “RightValue” shown in FIG. 8, the grammar analysis / storage means 3 stores the location of the assignment statement, and the character string in the grammar analysis variable is the left side value / right side value of the assignment statement. Remember. As a result, the display unit 4 searches for an identifier whose name is the character string stored as the left side value / right side value, and if the type of the left side value and the right side value does not match, the location of the assignment statement on the document display screen Warning information can be displayed in the vicinity of. This is particularly useful when using languages with insufficient type checking capabilities.

図11は、C言語の関数名を識別子として記憶し、文書のコメント部分の文字を状態commentとするための、文法記述ファイルの例である。実用上はさらにルールの追加が必要であるが、実施例の理解の補助のため記載した。  FIG. 11 is an example of a grammar description file for storing a C language function name as an identifier and setting a comment in a document as a state comment. Although it is necessary to add more rules for practical use, they are described to assist understanding of the embodiments.

なお、文法記述ファイルの記述は、ユーザーはグラフィカルなユーザーインターフェイスで編集でき、それをシステムが本実施例記載の文法に変換して保存するほうが望ましい。  The description of the grammar description file can be edited by the user with a graphical user interface, and it is preferable that the system converts the grammar description file into the grammar described in the present embodiment and saves it.

表示手段4での情報表示は、文書編集・参照中に、複雑な操作を必要とせずリアルタイムで表示され、かつ、処理速度が遅くなることで文書編集・参照の作業を妨げることがないようにするのが良い。また、文書の編集・参照を妨げない箇所に情報表示するのが良い。編集・参照作業を行う主体はあくまで人間であり、編集・参照作業をする人間をさりげなく適切に支援することが本発明の実施におけるポイントである。  The information display on the display means 4 is displayed in real time without requiring a complicated operation during document editing / referencing, and the document editing / referencing operation is not hindered by the slow processing speed. Good to do. In addition, information should be displayed at a location that does not interfere with editing / referencing of the document. The subject that performs the editing / reference work is a human being, and the point in carrying out the present invention is to appropriately support the person who performs the editing / reference work casually and appropriately.

本発明の原理構成図である。  It is a principle block diagram of this invention. 本発明の実施の形態の構成図である。  It is a block diagram of embodiment of this invention. 文法記述ファイルの基本文法である。  This is the basic grammar of the grammar description file. 状態遷移動作の例である。  It is an example of a state transition operation. 文法解析変数設定動作の例である。  It is an example of a grammar analysis variable setting operation. 識別子記憶動作・関数コール箇所記憶動作の例である。  It is an example of an identifier storing operation / function call location storing operation. 制御構造記憶動作の例である。  It is an example of control structure memory operation. ソース解析支援動作の例である。  It is an example of a source analysis support operation. 警告情報表示の文法記述ファイル記述例である。  It is a grammar description file description example of warning information display. 1:1対応チェックの文法記述ファイル記述例である。  It is a grammar description file description example of a 1: 1 correspondence check. C言語用の文法記述ファイルの例である。  It is an example of the grammar description file for C language.

符号の説明Explanation of symbols

1 文法記憶手段
2 文書
3 文法解析・記憶手段
4 表示手段
1a,1b 文法記述ファイル
1c 文法記述データ
1 Grammar storage means 2 Document 3 Grammar analysis / storage means 4 Display means 1a, 1b Grammar description file 1c Grammar description data

Claims (1)

文書の文法を表現する目的で作成された、複数個の{状態・文字列・文字列一致時の状態遷移先}からなる状態遷移ルールを記憶した文法記憶手段と、
前記文法記憶手段に記憶された状態遷移ルールに従って、文書の各文字の状態を決定し記憶する、文法解析・記憶手段と、
前記文法解析・記憶手段で決定された各文字の状態から得られる情報を表示する表示手段とからなることを特徴とする、
文書情報表示システム。
A grammar storage means for storing a state transition rule made up of a plurality of {states, character strings, state transition destinations when matching character strings}, created for the purpose of expressing the grammar of a document;
Grammar analysis / storage means for determining and storing the state of each character of the document in accordance with the state transition rules stored in the grammar storage means;
It comprises display means for displaying information obtained from the state of each character determined by the grammar analysis / storage means,
Document information display system.
JP2007248057A 2007-08-27 2007-08-27 Document information display system Abandoned JP2009054125A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007248057A JP2009054125A (en) 2007-08-27 2007-08-27 Document information display system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007248057A JP2009054125A (en) 2007-08-27 2007-08-27 Document information display system

Publications (1)

Publication Number Publication Date
JP2009054125A true JP2009054125A (en) 2009-03-12

Family

ID=40505123

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007248057A Abandoned JP2009054125A (en) 2007-08-27 2007-08-27 Document information display system

Country Status (1)

Country Link
JP (1) JP2009054125A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016038718A (en) * 2014-08-07 2016-03-22 日本電気株式会社 Correction device, translation device, correction method, and computer program
JP2016526744A (en) * 2013-07-12 2016-09-05 アビニシオ テクノロジー エルエルシー Parser generation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016526744A (en) * 2013-07-12 2016-09-05 アビニシオ テクノロジー エルエルシー Parser generation
JP2016038718A (en) * 2014-08-07 2016-03-22 日本電気株式会社 Correction device, translation device, correction method, and computer program

Similar Documents

Publication Publication Date Title
US10929449B2 (en) Generating a structured document guiding view
CN110059009B (en) Method and apparatus for testing code files
CN109800175B (en) Ether house intelligent contract reentry vulnerability detection method based on code instrumentation
Karrer et al. Stacksplorer: Call graph navigation helps increasing code maintenance efficiency
CN105138335B (en) A kind of function call path extraction method and device based on controlling stream graph
JP2005258944A (en) Device for analyzing program, analyzing method thereof, and program
WO2002033582A9 (en) Method for analyzing text and method for builing text analyzers
JP2007141123A (en) Link of same character strings in different files
Vollebregt et al. Declarative specification of template-based textual editors
US7730466B2 (en) System and method for manipulating source code in a text editor
CN111124479A (en) Configuration file analysis method and system and electronic equipment
CN110096264A (en) A kind of code operation method and device
US8516467B2 (en) Method and apparatus for enhancing comprehension of code time complexity and flow
US20130185698A1 (en) Simplifying analysis of software code used in software systems
US8225275B2 (en) System and method for providing indicators of textual items having intrinsic executable computational meaning within a graphical language environment
JP2020068011A (en) Patent document drawing material guide content automatic acquisition display facility
Nguyen et al. Varis: IDE support for embedded client code in PHP web applications
JP2009054125A (en) Document information display system
CN103744678A (en) Method for determining static function call relations based on register transfer language
KR102614967B1 (en) Automation system and method for extracting intermediate representation based semantics of javascript
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
JP2008059515A (en) Method, system, and program for displaying program execution process
CN107577476A (en) A kind of Android system source code difference analysis method, server and medium based on Module Division
JP2002288004A (en) Program source processing device and method, and program source processing program
JP2011221656A (en) Method for generating execution code, compiler, and compile device

Legal Events

Date Code Title Description
A762 Written abandonment of application

Free format text: JAPANESE INTERMEDIATE CODE: A762

Effective date: 20090313