Input Transformation Language (ITL)ITL is Promptu's language for dynamically evaluating text into expressions. ITL syntax<   >The open (<) and close (>) angle brackets denote the beginning and end of an ITL region, respectively, and are the most fundamental part of ITL. Example usage:
(Execution path)
(Arguments)
ITL expressionsAn ITL expression is composed of a combination of individual components (listed below) which immediately follow each other. They may, though not necessarily, be separated by spaces (which are ignored). String literalsString literals are used to add text in your ITL expressions. They begin and end with double quotes.
Note for those not familiar with the term string: a string is a "string" (or group) of characters.
String literals look like this:
Escape sequences in string literalsSometimes, you may wish to use the double quote within your string literal. You cannot merely use the double quote in your string literal because Promptu would think it is the terminating double quote. To solve this, Promptu allows you to escape the double quote with the backslash (\). Additionally, because the backslash is the escape character, it must be escaped with another backslash if you actually want a backslash character in your string literal.The following escape sequences are recognized by Promptu:
Example usage:
Function calls(See also Writing External Functions)
Function calls enable you to invoke code in external .NET assemblies.
Functions always return a Example usage:
myFunction
myFunction SubstitutionsSubstitutions enable the capturing of arguments typed in the prompt following the command name. There are two types of substitutions: 1. Imperative substitutionAn imperative substitution is a substitution which must be made or else the command invocation will fail. The most basic imperative substitution is represented by the following format:
This is the second form which an imperative substitution may take:
Example usage:
2. Optional substitution
The optional substitution is similar to the imperative substitution,
except that it does not cause command invocation to fail if the argument is not provided.
This is the second form which an optional substitution may take:
The optional substitution may also specify alternate text (in the form of a string literal)
or ITL expression to be used if the arguments are not provided.
Example usage:
A real world exampleWikipediaA good example of ITL in use is a command which launches Wikipedia and searches using any number of keywords provided as arguments in the prompt.
First, we begin creating a new command and name it
To perform Wikipedia searches from Promptu, all we need to do is put any arguments supplied after the We start with the open angle bracket (<). Currently, our ITL looks like this:<
Since we want to capture arguments from the prompt, we will need to use a substitution.
We probably want to mandate that the user has to specify arguments; otherwise, our <!n!
We finish it off with the close angle bracket (>) Our final ITL looks like this:<!n!>
We put the partial Wikipedia URL in the execution path and follow it with the ITL we just created.
http://en.wikipedia.org/wiki/Special:Search?search=<!n!>
enc command, and then you will be all set to search Wikipedia from your Promptu prompt.
Searching Wikipedia for something such as "hammered dulcimer" is now as easy as typing enc hammered dulcimer in the prompt and hitting Enter! |