V2 still no way to add new language definitions

Discussion Forums discussion V2 still no way to add new language definitions

This topic contains 0 voices and has 4 replies.

Viewing 5 posts - 1 through 5 (of 5 total)
Author Posts
Author Posts
February 28, 2011 at 4:23 pm #5212

Ranandar
Member

I am disappointed that there is still no way to add a new language definition in version 2. The few instructions available are impossible to comprehend and trial and error scheme editing has gotten me nowhere. I am also disappointed that there is no repository of language add-ins from users, apparently because nobody can figure out how to do it.

There are two things I was specifically looking for. One is support for LSL, the scripting language used in many online 3D games. Second is a text print definition where default colors are overridden with black text on white background for printing.

Programmer’s Notepad has too many great features to completely give up on it. I use it mostly for PHP, C and C# It works great for included languages, except for printing. I just cannot understand why the ability to add new languages is not supported.

February 28, 2011 at 6:27 pm #17674

Nux
Member

From a quick look I think you can easily base LSL scheme on C or JavaScript. You can do this by adding keywords (one or more class) to schemesmaster.scheme. You the need to add your language in cpp.scheme and copy paste the language tag of JavaScript and change it to your needs. Just note that the name should not be longer then 8 characters (not sure if longer names are still are problem, but they were in some version).

March 3, 2011 at 11:33 pm #17676

simon
Key Master

FWIW there is support for custom languages, it’s just not as well documented as it should be. I know this, and plan to work on it when I find time.

There’s a sample user scheme in the Samples directory under Programmer’s Notepad, you could try adapting that and then copy into the schemes directory. Post here for more support if you get stuck. There is some documentation for scheme file values here, but it’s not complete or intuitive yet:

http://pnotepad.org/docs/howto/add_support_for_your_language

Nux: For adding derivative schemes you should only need to add your keywords in your .scheme file, not master.scheme. Master.scheme should never need modifying. The reason javascript keywords are in master.scheme is because they’re shared between schemes – most languages do not need this, and I may find a way to improve it in the future.

March 4, 2011 at 9:41 am #17677

simon
Key Master

And in fact, here is how to use schemedef to add support for LSL:

<?xml version="1.0" ?>
<Scheme>
<keyword-classes>
<keyword-class name="lsl.flowcontrol">
for if else while do-while jump return state default
</keyword-class>
<keyword-class name="lsl.types">
integer float string key list vector rotation
</keyword-class>
<keyword-class name="lsl.events">
state_entry state_exit touch_start touch_end collision_start collision collision_end land_collision_start land_collision land_collision_end
timer listen sensor no_sensor control at_target not_at_target at_rot_target not_at_rot_target money email run_time_permissions
attach dataserver moving_start moving_end on_rez object_rez link_message changed remote_data http_response http_request
</keyword-class>
</keyword-classes>

<schemedef name="lsl" title="LSL" author="Simon Steele" url="http://www.pnotepad.org/&quot; version="1" casesensitive="false" braces="{[()]}">

<strings>
<stringtype id="0" start="&quot;" end="&quot;" multiline="true" escape="" />
</strings>

<identifiers start="[a-zA-Z]" />

<comments>
<line start="//" />
</comments>

<numbers start="[0-9]" content="[0-9a-f.x]" />

<!-- From here on is the traditional scheme definition block... -->
<lexer name="lsl" />
<use-styles>
<style name="Default" key="32" />
<style name="Line Comment" key="1" class="comment" />
<!-- <style name="Block Comment" key="2" class="comment" /> -->
<style name="Identifier" key="3" class="identifier" />
<style name="Number" key="4" class="number" />
<style name="Flow Control" key="5" class="keyword" />
<style name="Types" key="6" class="keyword2" />
<style name="Events" key="7" class="keyword2" fore="008080" />
<style name="String" key="10" class="string" />
<style name="Special Identifier" key="13" fore="478698" />
</use-styles>

<use-keywords>
<keyword key="0" name="Flow Control" class="lsl.flowcontrol"/>
<keyword key="1" name="Types" class="lsl.types"/>
<keyword key="2" name="Events" class="lsl.events"/>
</use-keywords>

</schemedef>
</Scheme>

Just save this as lsl.schemedef in your schemes directory, and restart PN. You can now select this scheme. To make it get used automatically for LSL files go to Options | Files and set the extension to map to LSL.

Edit: You can also now download this here:

http://pnotepad.googlecode.com/files/lsl.schemedef

March 27, 2011 at 12:36 pm #17678

hoemaco
Member

Hi! I tried out this lsl.schemedef, but it does nothing for me. That is, I can select LSL in the syntax menu, but all the text remains black.

(Actually I wanted to create a PIC asm syntax based on the asm syntax, it didn’t work, so tried to see if this lsl works…)

The link noted earlier contains no information that can’t be guessed. The big problem with documentation is that users can’t help (I’d really like to), as we simply don’t know how it works…

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.