Note Pad ++ EKL Language

Print Friendly, PDF & Email

Note Pad ++ EKL Language

I like using NotePad++ (You can download it here, well there). One of the neat thing’s you can do with it is define the syntax decoration for a user defined language. I’m going to show you how to so this for EKL, so you can develope outside of the CATIA or 3DX.

I’m going to walk you through how I like to style the code you can change this to your liking, this post just walks you through how to create and customize a new Notepad++ language.

NotePad++

Obviously the first thing is to downland and install NotePad++, once thats done we can define a custom language.

Defining a New Custom Language

You can find the NotePad++ documentation here.

Within NotePad++ select Language -> User Defined Language -> Define your Language from the top dropdown menu.

Within the User Defined Language dialogue window, select Create new…, then key in EKL and select OK.

Now we have the new custom language created but not customized we will Dock the Custom Language dialoged window, and then swap to the Comment & Number tab.

To see the changes live, we need to change the active language to EKL, select Language -> EKL from the top dropdown menu.

Comments

Within NotePad++ create a new document and add the following;

/* Here is a Comment */

// Here is a Comment

EKL has two type’s of comments /* … */ and // this can be managed in two places within the NotePad++ Comments and Number tab.

  • First select the Comment Line Styler button.
  • Set the Color to Dark Green.
  • Select Ok.
  • In the Comment Line Style Open field enter //.
  • Set the Comment Style again to Dark Green.
  • In the Comment Style Open field enter */.
  • In the Comment Style Close field enter /*.

We should now see the two comment types adopt the Style defined.

Operators and Delimiters

In the Notepad++ document add the additional content as shown below.

// Next well style these Symbols
// == = < > => <= <> . -> \ ( ) " " [ ] + - * / | ** #

Let ioPoint1, ioPoint2 ( Point )

ioPoint1 = point( 0mm , 0mm , 0mm )
ioPoint2 = point( 10mm , 20mm , 30mm )

If ( distance( ioPoint1 , ioPoint2 ) == 0mm )
Or
( distance ( ioPoint1 , ioPoint2 ) <> 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) < 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) > 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) <= 5mm )
And
( distance ( ioPoint1 , ioPoint2 ) >= 15mm )
{
	Notify( "Hello World! From : #" , "Bob" )
}

Next we will change the active tab to Operators & Delimiters.

  • Select the Styler button for Operators Styles.
  • Set the Color to Orange, and select Ok.
  • Add the following operators to the Operators 1 field ( == = < > => <= <> . -> \ ( ) ” ” [ ] + – * / | ** # ) .

We should now see the color update in the Notepad++ document.

Keywords List

The Keywords List tab will be the main Meat and Potatoes of the formatting, so let’s switch tab to the Keywords List tab.

1st Group

Within the 1st Group change the Styling to Red and uncheck the Underline option, then add the following EKL Geometry object Types.

Point Line Plane Circle Surface Curve AxisSystem List
2nd Group

Within the 2nd Group change the Styling to Purple and uncheck the Underline option, then add the following EKL data object Types.

Integer String Real
3rd Group

Within the 3rd Group change the Styling to Pink and uncheck the Underline option, then add the following EKL Keywords.

Let let AND And and OR Or or 
4th Group

Within the 4th Group change the Styling to Dark Green and uncheck the Underline option, then add the following EKL Keywords.

For for inside While while If if IF Else else ELSE
5th Group

Within the 5th Group change the Styling to Dark Blue and uncheck the Underline option, then add the following Comma and Boolean Values.

,  True TRUE true False FALSE false
6th Group

Within the 6th Group change the Styling to Dirty Light Blue and uncheck the Underline option, then add the following Magnitudes.

Angle Length Area Mass ANGLE LENGTH AREA MASS
7th Group

Within the 7th Group change the Styling to Dark Purple and uncheck the Underline option, then add the following Property’s.

color show
8th Group

Within the 8th Group change the Styling to Dirty Green and uncheck the Underline option, then add the following Methods.

SetAttributeString SetAttributeDimension SetAttributeInteger SetAttributeReal
Notify Message
point line plane 
direction 
distance 
disassemble 
angle length area

Testing the Formatting

If we add the following EKL code to the Notepad++ document.

/* Here is a Comment */
// Here is a Comment

Let ioPoint1, ioPoint2 ( Point )

ioPoint1 = point( 0mm , 0mm , 0mm )
ioPoint2 = point( 10mm , 20mm , 30mm )

If ( distance( ioPoint1 , ioPoint2 ) == 0mm )
Or
( distance ( ioPoint1 , ioPoint2 ) <> 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) < 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) > 10mm )
Or
( distance ( ioPoint1 , ioPoint2 ) <= 5mm )
And
( distance ( ioPoint1 , ioPoint2 ) >= 15mm )
{
	Notify( "Hello World! From : #" , "Bob" )
}

Let ioString ( String )
ioString = "BobsBurgers"
ioPoint.color = "Blue"
ioPoint->SetAttributeString( "AttrString" , ioString )
ioPoint->SetAttributeDimension( "X" , 1mm , "LENGTH" )

let ioPlane ( Plane )
Let ioLine ( Line )
Let ioCircle ( Circle )
Let ioSurface ( Surface )
Let ioCurve ( Curve )
Let ioAxisSystem ( AxisSystem )

Let ioIndex ( Integer )
Let ioCounter ( Real )
Let ioString ( String )

ioIndex = 1
For ioIndex While ioIndex <= 10
{
	let ioAngle ( Angle )
	ioAngle = angle( plane( 0, 0, 1, 0mm ) , plane( 0, 1, 0, 0mm ))
	
	Let ioList( List )
	ioList = disassemble( ioSurface , True )
	
	Let ioSubSurface ( Surface )
	ioSubSurface = ioList[1]
	ioSubSurface->SetAttributeString( "Name" , "Value is : \" ioString \"")
}

We should now see a nicely formatted code.

We can keep tweaking the formatting to refine it a little more if we want to. Although we do need to do one more thing which is folding.

Folder and Default

Lets change to the Folder and Default tab.

We need to change the Default Style, by changing the Font to Yu Gothic, unchecking Italic, and Underlined.

Next we will add the block comment symbols into the Folding in Comment Style section.

And finally, in the Folding in Code 1 Style we need to add in the Open and Close Curly Braces.

When we now look at the code we will find that the Block Comments and If, Else If, For inside, and For While sections can now be collapsed.

and

UDL XML File

Within the language Editor the User Defined Language XML can be Imported or Exported.

Below is the Export of the UDL XML file I created while I wrote this post, feel free to copy this into an EKL.xml file and import it into Notepad++ and customize it further.

<NotepadPlus>
    <UserLang name="EKL" ext="" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="yes" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00// 01 02 03/* 04*/</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">== = &lt; &gt; =&gt; &lt;= &lt;&gt; . -&gt; \ &quot; &quot; [ ] + - * / | ** # ( ) </Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open">{</Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close">}</Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open">/*</Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close">*/</Keywords>
            <Keywords name="Keywords1">Point Line Plane&#x000D;&#x000A;Circle Surface Curve AxisSystem List</Keywords>
            <Keywords name="Keywords2">Integer String Real</Keywords>
            <Keywords name="Keywords3">Let let AND And and OR Or or </Keywords>
            <Keywords name="Keywords4">For for inside While while If if IF Else else ELSE</Keywords>
            <Keywords name="Keywords5">,  True TRUE true False FALSE false</Keywords>
            <Keywords name="Keywords6">Angle Length Area Mass ANGLE LENGTH AREA MASS</Keywords>
            <Keywords name="Keywords7">color show</Keywords>
            <Keywords name="Keywords8">SetAttributeString SetAttributeDimension SetAttributeInteger SetAttributeReal Notify Message  point line plane direction distance disassemble angle length area</Keywords>
            <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="@Yu Gothic" fontStyle="1" fontSize="8" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="FF0000" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="8080FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="008080" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="00C6C6" bgColor="FFFFFF" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="400080" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="808000" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="FF8040" bgColor="FFFFFF" fontStyle="3" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="008080" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="FF0000" bgColor="FFFFFF" fontStyle="1" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="0080FF" bgColor="FFFFFF" fontStyle="7" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>