Keywords¶
The exchange-structure keywords of ISO 10303-21 are recognised as two families:
ISO-10303-21 and END-ISO-10303-21 are emitted as Keyword.Namespace, while
the section keywords are Keyword.Reserved. HEADER, DATA and ENDSEC
belong to the second edition; ANCHOR, REFERENCE and SIGNATURE open the
optional sections that the third edition (2016) added. They are case-insensitive,
like the EXPRESS lexer.
A full minimal exchange file:
ISO-10303-21;
HEADER;
FILE_DESCRIPTION((''),'2;1');
FILE_NAME('','',(),(),'','','');
FILE_SCHEMA(('SOME_APPLICATION_PROTOCOL'));
ENDSEC;
DATA;
#1= THING(1);
ENDSEC;
END-ISO-10303-21;
ANCHOR and REFERENCE open optional sections of their own — they are not part
of the header section. Their items are written with the third edition's
occurrence names and resources:
A signature section opens with the special token SIGNATURE; and closes with
ENDSEC; (clause 14.1). Its Base64 content is lexed line by line:
Third-edition tokens¶
The productions the third edition adds render as follows:
#1= A(<other.stp#2>);
#2= B(@12,@PI,#PI);
ANCHOR;
<part> = #20 {tag_name:'anchor_item'};
ENDSEC;
<other.stp#2>— a resource or an anchor name (RESOURCE,ANCHOR_NAME) isString.Other;@12— a value instance name isName.Labelwhere it defines the instance (@12 = …) andName.Variablewhere it references one;@PIand#PI— a constant value name and a constant entity name areName.Constant; table 1 folds the low line intoUPPER, so@PI_2and#_INCHare constant names too;{tag_name:'anchor_item'}— an anchor tag keeps its braces and its tag name asName.Attribute, while the anchor item between them is lexed by the same rules as the rest of the file (#20is a reference there as it is here), and a string or a remark inside the tag may contain}without closing it early;- the Base64 of the signature section above is
String.Other, and may be written over several lines.
Case
Clause 6.3 defines a keyword as capital letters, digits and low lines
(plus an optional leading !), and table 2 defines the occurrence names in
the same spirit. StepFileLexer matches all of them case-insensitively
anyway — header;, @pi and #pi highlight like their upper-case forms —
because a lenient lexer is more useful on real files, and these pages show
the canonical upper-case spelling.