Language

Table of Contents

logo-large

Tutorial Actifsource Tutorial – Language
Required Time - 15 Minutes
Prerequisites - Actifsource Tutorial – Installing Actifsource
- Actifsource Tutorial – Simple Service
Goal - Enabling syntax highlighting for any programming language
Topics covered - Create a new Language
- Use the new Language
Notation ↪ To do
ⓘ Information
Bold: Terms from actifsource or other technologies and tools
Bold underlined: actifsource Resources
Monospaced: User input
Italics: Important terms in current situation
Disclaimer The authors do not accept any liability arising out of the application or use of any information or equipment described herein. The information contained within this document is by its very nature incomplete. Therefore the authors accept no responsibility for the precise accuracy of the documentation contained herein. It should be used rather as a guide and starting point.
Contact Actifsource AG
Täfernstrasse 37
5405 Baden-Dättwil
Switzerland
www.actifsource.com
Trademark Actifsource is a registered trademark of Actifsource AG in Switzerland, the EU, USA, and China. other names appearing on the site may be trademarks of their respective owners.

Overview

  • Preparation
  • Create a new Language
  • Using the Language

Part I Preparation

image2 image2

  • Prepare a new actifsource Project named ch.actifsource.tutorial.language as seen in the Actifsource Tutorial Simple Service

Part II Create a new Language

  • Instances of Language describe the following language elements

    • Keywords
    • Single Line Comments
    • Multi Line Comment
    • Color and font type
  • Let’s create an new Language instance for a fictitious math language

image3 image3

  • Select the package language
  • Use the New Resource Tool to create a Resource of type Language

image4 image4

  • Name the Language Math

  • Click Finish

image5 image5

  • Define the file name extension for the new language
  • Define your keyword style: color DarkRed, fontModifier Bold
  • Define your keywords: var, add, sub, mul, div
  • Define your single line comment style: color DarkGreen, fontModifier Italic
  • Define your single line comment tag: #
  • Use a StringStyle to define string coloring

Part III Use the new Language

  • The actifsource template editor is now supporting the new Languagefor the specific file extensions
  • Let's test the new syntax highlighting

image6 image6

  • Create a new Template in the Package language

image7 image7

  • Name the Template Test
  • Click Finish
  • Ignore the warning “No build config selected.”

image8 image8

  • In the file line, choose the file extension .math
  • The Language is Math selected automatically
  • Use Content Assist (Ctrl+Space) to select the language manually (i.e. if there is no file extension)
  • Use Ctrl+Click on the Language to open the Language Resource

image9 image9

  • Add some Code using the new keywords
  • Try to write some comments

actifsource-point-large