HistoryCal - V0.0.7 Manual
Define vocab

Home Development V0.0.7 Manual Script Define vocab

vocab Statement

The vocab statement defines a vocabulary which can later be incorporated into a grammar definition. It describes a series of text tokens and their equivalent numerical values.

The vocab must be given a unique (within all other vocabs) code name by which it can be referred to. It then must contain the following sub-statements in between '{' and '}' brackets.

vocab Sub-Statement List
nameGive the vocab a text description.name "Month names";
fieldnameThe field name normally associated with this vocab.fieldname month;
langThe language used. (Not in use yet.)lang en;
stylenameThe text used by format to describe the tokens.stylename Month, Mon";
tokensA list of values, tokens and an optional abbreviation.tokens {1, January, Jan; ...}

name Sub-Statement

Gives a descriptive name to the vocabulary. Used by the HistroyCal program when showing a 'pick-list' of available vocabularies to select.

fieldname Sub-Statement

This optional statement links the vocabulary to a particular field name for a given scheme. When used, it enables a scheme element to entered outside of the normal element ranking system. For example: "Sun Sep 1948" could be identified as all Sundays during September 1948. This is possible because Sunday is recognised as a weekday and so entered into the wday field rather than simply converted to its value of 1 and becoming "1 9 1948".

lang Sub-Statement

This statement sets the language for the vocabulary. Multi-lingual versions of the program have not yet been developed, so this is a marker for the future.

stylename Sub-Statement

The stylename is used by a format definition when creating the pseudo date used to show the intended output. The pseudo date is the text shown when selecting the output format, as in the string "dd Mon yyyy" for the dmy format. The 'Mon' in that string indicates that output will use the abbreviated value from the vocabulary.

tokens Sub-Statement

A list of the value and token names. A second token for a value may be given to be used as an abbreviation.

Each token takes the form of a comer separated list of the value, token, optional abbreviaton terminated with a ';' semi-colon. The list of tokens is enclosed within '{' '}' braces.

If the token name does not conform to script name token, then they must be enclosed in '"' double quotes.

Example Script
vocab w { name "Weekday names"; fieldname wday; lang en; stylename Weekday, WDay; tokens { 1, "Monday", "Mon"; 2, "Tuesday", "Tue"; 3, "Wednesday", "Wed"; 4, "Thursday", "Thur"; 5, "Friday", "Fri"; 6, "Saturday", "Sat"; 7, "Sunday", "Sun"; } }

Valid XHTML 1.0 Strict

12th October 2016