User Tools

Site Tools


cw4:creating_xrpl_scripts

common_scripting_language

Creating xRPL scripts

Any text editor can be used to edit xRPL files. However, syntax highlight and auto completion makes coding a lot easier. Support files are provided for several available editors.

Notepad++

Notepad++ is a popular, free, open-source editor.

Notepad++ can be obtained from here: http://notepad-plus-plus.org/

Make sure you download only from the official Notepad++ website to avoid malware. https://notepad-plus-plus.org/
  • Once Notepad++ is installed you can add syntax highlight for the CRPL language. Currently there are two sample thems, one for the “normal (llisth) theme and one for the “dark” (Deep Black) theme.
  • Download either (or both) of those files, then:
    • Open Notepad++, select Language from the menu bar, click “Define Your Language”, then “Import”.
  • You can add keyword auto completion to Notepad++ by download this file 4rpl.xml
    • To install into Notepad++ you need to copy 4rpl.xml to your Notepad++ install directory\plugins\APIs directory. Then, restart Notepad++. Next, go to the Settings/Preferences menu in Notepad++. Click the “Backup/Auto-Completion” tab. Check the “Enable auto-completion on each input” checkbox, and make sure the “Function completion” radio button is selected.
  • Alternatively, download this file crpl.xml instead, which works for keyword auto completion as well, but also contains the input, output, and the description of each command.
    • Use the same process to install as above. To see the description of the command, type the opening bracket ”(“ after the command you want to see help for. Then press Esc to dismiss the help, or click elsewhere in the code. Disclaimer: these hints were autogenerated from the wiki, so the formatting might not be the best.
  • You can also create a keyboard shortcut to open the wiki of the current command you have your cursor on.
    • In Notepad++, go into “Run -> Run”, then type https://knucklecracker.com/wiki/doku.php?id=crpl:docs:$(CURRENT_WORD) into the input field and click “Save”. After that, select a name (for example “Open CRPL Wiki”) and a keyboard shortcut (for example Ctrl+Shift+H) and click OK, then just close the Run… dialog. After that, you should see your shortcut in the “Run” menu, and you can use it to open the current command (the one that your input cursor is currently on) in the wiki.

By default, Notepad++ has a “reto” look (to put it kindly). The UI for it has not been revamped since inception. For those that prefer, notepad++ has several dark theme, and here is a link to a Material design. Clearly the UI can't be changed, but at least it will be less glaring on the eyes.

Visual Studio Code

Visual Studio Code can be obtained from here: https://code.visualstudio.com/.

Features:

  • Syntax Highlighting
  • Looking stuff up on the wiki
  • Syntactical diagnostics (making sure block delimiters match, $ parameters are at the start of the file, etc)
  • Implements several VSCode features for named entities (variables/functions): go-to-definition, rename, and find references
  • Checks to make sure variables are used (written to at least once and read from at least once)

Instructions:

Sublime Text

Sublime Text can be obtained from here: https://www.sublimetext.com/3.

Features include syntax highlighting and auto completion.

Instructions:

  • In Sublime Text, go to Tools -> Command Palette.
  • Type “Install Package Control” and hit Enter.
  • Open the Command Palette again and type “Package Control: Install Package”.
  • In the menu that opens, type “CRPL”, then select the Creeper Reverse Polish Language package.
  • All files with the *.crpl extension should now use this package.

Translation Front-end

Forum user Arin112 (Discord: Arin112#8343) wrote a C-lookalike front-end translator that will produce xRPL code as output.

There is a reference to the translator (MplLang) on the forum , and the source code and examples are on Github.

Time permitting, this deserves a more complete treatment and probably a section of it's own.



Miscellaneous Highlighting Schemes

Syntax Highlighting in the Wiki

Dokuwiki uses GeSHi syntax highlighting.

Syntax Highlighting for Discord

cw4/creating_xrpl_scripts.txt · Last modified: 2023/10/18 15:46 by Nicant