The Structure of Tokens

Navigation:  Tokens >

The Structure of Tokens

Previous pageReturn to chapter overviewNext page

Each token represents a specific way of looking at, and displaying, a date and information that relates to it. The date of a token is determined by its DayValue and the structure of the scanned Template. This means that every token of the same DayValue corresponds to the exact same date; it is the difference in TokenRoot (and possibly LanguageTag) that leads to the displaying of different information.

 

Q++ expects tokens to have the following structure (the spaces in the example below are there only for clarity; there should never be any spaces between any of the different parts of a token) :

 

[ LanguageTag DayValue Prefix TokenRoot Suffix ]

 

The various parts of a token are :

 

LanguageTag

A letter from 'a' to 'z' denoting the language to use for a particular token. This letter must appear immediately after the opening brace [ of the token. Most of the time, for single-language diaries, tokens will not need a LanguageTag (see remark below).

DayValue

A number from 1 to 588 (14 times 42) which denotes, with respect to the current grid, which day a token refers to. For example in a weekly grid, DayValues will range from 1 to 7, 1 referring to the first day of the grid (usually, but not necessarily, Monday). If the token contains a LanguageTag, then the DayValue occurs immediately after, if not then the DayValue occurs immediately after the opening brace [.

TokenRoot

The TokenRoot is the fundamental part of a token. Most of the time the terms token and TokenRoot will be used interchangeably. Click here to go to the list of all TokenRoots.

Prefix

It is an optional part that comes before the TokenRoot. See zap tokens and Prefixes.

Suffix

It is an optional part that, if present, occurs between the TokenRoot and the closing brace. See Suffixes.

 

 

Some important remarks about tokens :

 

If a token contains no LanguageTag, Q++ will assume it is equal to 'a'.

 

If a token contains no LanguageTag, then the DayValue can also be omitted. In that case, if a token contains no DayValue, Q++ will assume it is equal to 1.

 

Tokens are case-sensitive. The tokens [d] and [D] are totally different.

 

Tokens start with an opening brace [ and end with a closing brace ].

 

If you wish to use plain text containing braces, make sure you add an underscore to each brace, [_ and _], to tell Q++ that the text contained is not a token.

 

Tokens should not contain any spaces.

 

Finally, note that the evaluation of tokens is recursive; that means that the result of converting a token can be another token or even a series of tokens.


Topic 137 updated on 13-May-2016.
Topic URL: http://www.qppstudio.net/webhelp/index.html?thestructureofq__tokens.htm