Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mscripteditor [2017/12/22 02:17] admin [MScript Coverage] |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== MScript Editor ===== | ||
- | //MScript Editor// is a full-feature source code editor (xml scripting) that allows you to view and edit [[mScriptTags|MScript]] for each trigger point or mScript for the entire model. | ||
- | |||
- | It offers code-assist (ctrl-space), | ||
- | |||
- | During and after model execution, it can display the script test coverage. | ||
- | |||
- | |||
- | {{http:// | ||
- | |||
- | ---- | ||
- | ==== Open MScript Editor ==== | ||
- | //MScript Editor// is a tab which can be placed in any of the 3 panes. | ||
- | |||
- | When you click /select a state or transition, //MScript Editor// automatically loads the mscript for the corresponding state or transition. | ||
- | |||
- | Changes are automatically pushed to the server when you move focus to other tabs in the IDE. | ||
- | |||
- | ---- | ||
- | ==== Editing Triggers ==== | ||
- | There are many [[Triggers|System Defined Triggers]] for each state, transitions as well at model level. | ||
- | |||
- | You may also view / edit mScript for the entire model by selecting the //model// in the trigger drop-down list. | ||
- | |||
- | Editor allows you to check mscript syntax. To do so, click {{http:// | ||
- | |||
- | |||
- | === User Define Triggers=== | ||
- | You may also create your own trigger using [[User Defined Trigger|User Defined Trigger]]. | ||
- | |||
- | The new trigger will be added to the trigger drop-down list available for you to choose to add mscript. | ||
- | |||
- | === Program Structure Diagram=== | ||
- | You can generate [[Program Structure Diagram|Program Structure Diagram]] for the selected trigger. | ||
- | |||
- | To generate the //Program Structure Diagram//, hover mouse over {{http:// | ||
- | |||
- | === Trigger Call Hierarchy Diagram === | ||
- | //MScript// provides a function to call another trigger. This allows you to execute same trigger from different triggers. | ||
- | |||
- | To generate the [[Trigger Call Hierarchy Diagram]], edit the trigger which you want to use as the starting trigger in //Trigger Call Hierarchy Diagram//. Then mouse over {{http:// | ||
- | |||
- | |||
- | |||
- | |||
- | ===User Defined Functions=== | ||
- | You may create [[User Defined Functions|User Defined Functions]] that can be called anywhere in the model. These functions are declared in // | ||
- | |||
- | ---- | ||
- | ==== Shortcut Keys ==== | ||
- | MScript editor supports [[MScript Editor ShortCut Keys|MScript Editor Shortcut Keys]] that allow you to perform basic editor functions with keyboard keys, e.g. //ctrl-F// for find, // | ||
- | |||
- | ---- | ||
- | |||
- | ====Code Assist==== | ||
- | //Code Assist// is supported. | ||
- | |||
- | |||
- | {{http:// | ||
- | |||
- | |||
- | For example, if the cursor is on a blank line, the //Code Assist// list will be populated with list of mscript tags. If the cursor is inside the //op// attribute of a //assert// tag, then the popup list will be populated with compare operators available: //eq//, //lt//, //gt//, etc. | ||
- | |||
- | Below are the description of different //Code Assist// context supported with //ctrl - space// pressed: | ||
- | |||
- | * on a blank line - brings up the list of mScript tags. The selected tag is inserted with all attributes set to empty string. | ||
- | |||
- | * in an attribute value (between double quotes), code assist brings up the list of mScript methods. For some special attribute like //op//, a special list of values may be presented instead of mScript method list. | ||
- | |||
- | With // | ||
- | |||
- | |||
- | |||
- | ---- | ||
- | ==== Search / Replace Text ==== | ||
- | Editor supports plain text match search / replace and regular expression search / replace. | ||
- | |||
- | {{http:// | ||
- | |||
- | === How to Invoke Search/ | ||
- | To invoke search and/or replace, just press //ctrl-F// when //MScript Eitor// has the focus or clicking on the search button above the editor area {{http:// | ||
- | |||
- | //Search and Replace// is displayed right above the editor area when invoked. | ||
- | |||
- | You must run the search first, once you've found the first match, you may then replace the matched text (selected) with the replacement string. | ||
- | |||
- | There are different search criteria supported as described in //Search Text// section below. | ||
- | |||
- | === Searching Text === | ||
- | Enter a text into the search field to start the search. | ||
- | |||
- | Last searched text is remembered and will be displayed as default value when the //Search and Replace// is invoked again. | ||
- | |||
- | == Next / Previous == | ||
- | To navigate through the matched texts in the editor, use the two navigation button next to the search field. | ||
- | |||
- | While the cursor is in the search text field, you may use //Enter// or //down arrow// key to go to next match and //up arrow// to the previous match. | ||
- | |||
- | |||
- | == Case Sensitive or Insensitive == | ||
- | By default, the search is case sensitive if the search text contains one or more characters in uppercase. | ||
- | |||
- | == Regular Expression == | ||
- | //Regular expression// | ||
- | |||
- | |||
- | === Replacing Text === | ||
- | When you have found a match with //Search//, you can enter a replacement text. | ||
- | |||
- | As you enter the replacement text, two buttons //R// and //RR// will be displayed to the right of the replacement field. | ||
- | |||
- | == Single Replacement == | ||
- | Use the button //R// to perform the replacement on the current matched text (darker shade) at the same time move the current selection to the next matched text in the direction used in the last search. | ||
- | |||
- | Alternatively you can use //Enter// key to perform the replacement. | ||
- | |||
- | While the cursor is in the replacement field, you may use //down arrow// key to go to next match and //up arrow// to the previous match without performing the replacement. | ||
- | |||
- | Use //Search// buttons to change the direction for the next replacement. | ||
- | |||
- | |||
- | == Replace All == | ||
- | You may replace all matched texts in the direction of last search by clicking on the //RR// button. | ||
- | |||
- | To replace matched texts in the other direction, just click on one of the search button to find the next match and then click on //RR// to replace all matched texts. | ||
- | |||
- | The number of replacements performed is displayed next to the replacement buttons. | ||
- | |||
- | |||
- | |||
- | ---- | ||
- | |||
- | ====MScript Macro==== | ||
- | You may define a set of macros to encapsulate a set of frequently used mScript. This is done via editing the // | ||
- | |||
- | You may add tooltip to each of the macro by appending // | ||
- | |||
- | Macro file // | ||
- | |||
- | | ||
- | |||
- | To call up macros, press //ctrl+M// (or //alt+M//). | ||
- | |||
- | ---- | ||
- | |||
- | ====Requirements Tags==== | ||
- | If you have configured the interface to your requirements system, you may bring up a list of requirements by pressing //ctrl+R// (or //alt+R//). For more information about how to configure // | ||
- | |||
- | |||
- | |||
- | ---- | ||
- | ====Commenting mScripts==== | ||
- | |||
- | * code comments can added using xml comment tag. See an example below: | ||
- | |||
- | < | ||
- | |||
- | * you can add as many comments you would like anywhere in the mscript triggers. | ||
- | * you can continue to use //comment// parameter, but commenting using xml comment tag is recommended. | ||
- | * you may have the comments written out to an output file as mscript is executed. By default writing comments to an output file is off. It can be turned on with MScript function // | ||
- | |||
- | ---- | ||
- | |||
- | ====Debugging MScript==== | ||
- | |||
- | You can set breakpoint on mScript line by clicking on the line number column on the left of the editor. If mScript spans multiple lines, the breakpoint can only be set on the first line of the mScript. | ||
- | |||
- | ---- | ||
- | |||
- | ====MScript File==== | ||
- | |||
- | //MScript// is stored in // | ||
- | |||
- | ---- | ||
- | ==== MScript Coverage==== | ||
- | New in release 4.2, the system automatically collects execution coverage of each MScript tag during the model execution. | ||
- | |||
- | To retrieve MScript coverage metrics, select //MScript Coverage// from the drop-down menu at the upper-right corner of the editor. | ||
- | |||
- | === Coverage Metrics === | ||
- | The system collects the number of times each MScript tag is executed. | ||
- | |||
- | The coverage metrics are then displayed with two additional mscript attributes: // | ||
- | |||
- | * // | ||
- | * // | ||