Grammar for OmniMark 10.1

Table of Contents

Index of Productions

Notices

1 Program

[1] program unit ::=
program [2]
| module declaration [99]

[2] program [1] ::= program type [96]?, program-level declaration [104]*, preamble declaration [110]*, group member [91]*, identified group [89]*


2 Main Process Rules

[3] main process rule [92] ::=
process end rule [4]
| process rule [5]
| process start rule [6]

[4] process end rule [3] ::= PROCESS-END, condition [316]?, local scope [147]

[5] process rule [3] ::= PROCESS, condition [316]?, local scope [147]

[6] process start rule [3] ::= PROCESS-START, condition [316]?, local scope [147]


3 Markup Processing Rules

[7] markup processing rule [92] ::=
data content rule [8]
| document end rule [9]
| document start rule [10]
| dtd end rule [11]
| dtd start rule [12]
| element rule [13]
| epilog start rule [14]
| external data entity rule [15]
| invalid data rule [16]
| marked section rule [17]
| processing instruction rule [20]
| prolog end rule [21]
| prolog in error rule [22]
| sgml comment processing rule [18]
| sgml declaration end rule [23]
| translation rule [24]
| xmlns-change rule [25]

[8] data content rule [7] ::= DATA-CONTENT, condition [316]?, local scope [147]

[9] document end rule [7] ::= DOCUMENT-END, condition [316]?, local scope [147]

[10] document start rule [7] ::= DOCUMENT-START, condition [316]?, local scope [147]

[11] dtd end rule [7] ::= DTD-END, condition [316]?, local scope [147]

[12] dtd start rule [7] ::= DTD-START, condition [316]?, local scope [147]

[13] element rule [7] ::= ELEMENT, (element rule name set [29] | #IMPLIED), condition [316]?, local scope [147]

[14] epilog start rule [7] ::= EPILOG-START, condition [316]?, local scope [147]

[15] external data entity rule [7] ::= (EXTERNAL-DATA-ENTITY | EXTERNAL-ENTITY), (markup name set [33] | #IMPLIED), condition [316]?, local scope [147]

[16] invalid data rule [7] ::= INVALID-DATA, condition [316]?, local scope [147]

[17] marked section rule [7] ::= MARKED-SECTION, marked section type [27], condition [316]?, local scope [147]

[18] sgml comment processing rule [7] ::= (MARKUP-COMMENT | SGML-COMMENT), condition [316]?, local scope [147]

[19] markup error rule [92] ::= (MARKUP-ERROR | SGML-ERROR), condition [316]?, LOG?, local scope [147]

[20] processing instruction rule [7] ::= PROCESSING-INSTRUCTION, processing instruction matcher [26], condition [316]?, local scope [147]

[21] prolog end rule [7] ::= PROLOG-END, condition [316]?, local scope [147]

[22] prolog in error rule [7] ::= PROLOG-IN-ERROR, condition [316]?, local scope [147]

[23] sgml declaration end rule [7] ::= SGML-DECLARATION-END, condition [316]?, local scope [147]

[24] translation rule [7] ::= TRANSLATE, pattern expression [326], condition [316]?, local scope [147]

[25] xmlns-change rule [7] ::= XMLNS-CHANGE, condition [316]?, local scope [147]

[26] processing instruction matcher [20] ::=
pattern expression [326]
| NAMED, pattern expression [326], (VALUED, pattern expression [326])?
| VALUED, pattern expression [326], (NAMED, pattern expression [326])?

[27] marked section type [17] ::=
INCLUDE-START
| INCLUDE-END
| RCDATA
| CDATA
| IGNORE

3.1 Markup Names

[28] element name set [41] [43] [45] ::=
qualified element name [31]
| "(", qualified element name [31], ((OR | "|"), qualified element name [31])*, ")"

[29] element rule name set [13] ::=
restricted qualified element name [30]
| "(", restricted qualified element name [30], ((OR | "|"), restricted qualified element name [30])*, ")"

[30] restricted qualified element name [29] ::= (#BASE | #FULL)?, element name [32]

[31] qualified element name [28] [49] ::= (#BASE | #FULL | #XMLNS)?, element name [32]

[32] element name [30] [31] ::=
markup name [34]
| "~", string primary [265]

A "~" heralds a dynamic element name, where the string primary [265] is evaluated at run-time to determine the name of the element. This form of element name [32] is allowed only in ancestry qualifier [38].

[33] markup name set [15] [65] ::=
markup name [34]
| "(", markup name [34], ((OR | "|"), markup name [34])*, ")"

[34] markup name [32] [33] [40] [44] [51] [72] [73] [87] ::=
constant string literal [278]
| name [464]

[35] built-in read-only dtd shelf name [347] [450] ::=
#CURRENT-DTD
| SGML-DTDS
| XML-DTDS

[36] built-in markup source name [360] ::= #CONTENT

[37] built-in read-only markup-event shelf name [346] [450] ::= #CURRENT-MARKUP-EVENT

3.2 Elements

[38] ancestry qualifier [32] [45] [69] [70] [192] [247] [265] [445] ::= OF, ancestry expression [39]

[39] ancestry expression [38] [237] ::=
ancestry secondary [40]
| PREVIOUS, (OF, ancestry secondary [40])?
| DOCTYPE

[40] ancestry secondary [39] [44] ::=
ancestry primary [41], (OF, ancestry secondary [40])?
| markup event primary [346]
| CURRENT, ELEMENT, markup name [34]

[41] ancestry primary [40] ::=
ANCESTOR, element name set [28]
| OPEN, ELEMENT, element name set [28]
| PREPARENT, element name set [28]
| ELEMENT
| PARENT

3.2.1 Element Tests

[42] element test primary [318] ::=
element identity test primary [43]
| element property test primary [45]

[43] element identity test primary [42] ::= element test ancestry identifier [44], (IS | ISNT), element name set [28]

[44] element test ancestry identifier [43] ::=
(ANCESTOR | OPEN, ELEMENT | PREPARENT | PARENT | ELEMENT | PREVIOUS), (OF, ancestry secondary [40])?
| DOCTYPE
| CURRENT, ELEMENT, markup name [34]

[45] element property test primary [42] ::=
CONTENT, ancestry qualifier [38]?, (IS | ISNT), content type set [46]
| LAST, PROPER?, CONTENT, ancestry qualifier [38]?, (IS | ISNT), element name or data set [48]
| LAST, PROPER?, SUBELEMENT, ancestry qualifier [38]?, (IS | ISNT), element name set [28]
| PREVIOUS, ancestry qualifier [38]?, (IS | ISNT), element name set [28]
| STATUS, (OF, LAST, SUBELEMENT)?, ancestry qualifier [38]?, (IS | ISNT), (PROPER | INCLUSION)
| USEMAP, ancestry qualifier [38]?, (IS | ISNT), short reference map name set [50]

[46] content type set [45] ::=
content type [47]
| "(", content type [47], ((OR | "|"), content type [47])*, ")"

[47] content type [46] ::=
ANY
| CDATA
| CONREF
| DECLARED-EMPTY
| ELEMENT
| EMPTY
| EMPTY-TAG
| MIXED
| RCDATA

[48] element name or data set [45] ::=
element name or data [49]
| "(", element name or data [49], ((OR | "|"), element name or data [49])*, ")"

[49] element name or data [48] ::=
qualified element name [31]
| #DATA

[50] short reference map name set [45] ::=
short reference map name [51]
| "(", short reference map name [51], ((OR | "|"), short reference map name [51])*, ")"

[51] short reference map name [50] ::=
markup name [34]
| name [464]
| #EMPTY
| #NONE

3.3 Entity and Notation Tests

[52] entity test primary [318] ::=
qualified attribute part identifier [66], (IS | ISNT), entity category set [55]
| ENTITY, (IS | ISNT), entity category set [55]
| notation selector [54], (IS | ISNT), notation category set [57]
| notation selector [54], equivalence comparer [320], notation name set [65]

[53] entity selector [54] ::=
ENTITY
| qualified attribute part identifier [66]

[54] notation selector [52] ::= NOTATION, (OF, entity selector [53])?

[55] entity category set [52] ::=
entity category [56]
| "(", entity category [56], ((AND | "&"), entity category [56])*, ")"
| "(", entity category [56], ((OR | "|"), entity category [56])*, ")"

[56] entity category [55] ::=
anonymous entity type [63]
| default entity type [62]
| entity class [61]
| entity scope [64]
| entity type [60]
| external identifier type [59]

[57] notation category set [52] ::= notation category [58]

[58] notation category [57] ::= external identifier type [59]

[59] external identifier type [56] [58] ::=
PUBLIC
| SYSTEM
| IN-LIBRARY

[60] entity type [56] ::=
CDATA-ENTITY
| NDATA-ENTITY
| SDATA-ENTITY
| SUBDOC-ENTITY

[61] entity class [56] ::=
GENERAL
| PARAMETER

[62] default entity type [56] ::= DEFAULT-ENTITY

[63] anonymous entity type [56] [87] [88] ::=
#CAPACITY
| #CHARSET
| #DOCUMENT
| #DTD
| #SCHEMA
| #SYNTAX

[64] entity scope [56] ::=
INTERNAL
| EXTERNAL

[65] notation name set [52] ::= markup name set [33]

3.4 Attributes

[66] qualified attribute part identifier [52] [53] [67] [68] [69] [70] [265] [354] ::=
(simple qualified attribute set identifier [70], indexer [451] | DATA-ATTRIBUTE, attribute name [73], OF, qualified attribute part identifier [66])
| simple qualified attribute identifier [69], item indexer [452]?

[67] qualified attribute identifier [79] [192] [214] [249] [267] ::=
(simple qualified attribute set identifier [70], indexer [451] | DATA-ATTRIBUTE, attribute name [73], OF, qualified attribute part identifier [66])
| simple qualified attribute identifier [69]

[68] qualified attribute set identifier [80] [214] [249] ::=
attribute subset specifier [71]?, DATA-ATTRIBUTES, OF, qualified attribute part identifier [66]
| simple qualified attribute set identifier [70]

[69] simple qualified attribute identifier [66] [67] [192] ::=
ATTRIBUTE, attribute name [73], ancestry qualifier [38]?
| DATA-ATTRIBUTE, attribute name [73], (OF, "(", qualified attribute part identifier [66], ")")?

[70] simple qualified attribute set identifier [66] [67] [68] [248] ::=
attribute subset specifier [71]?, ATTRIBUTES, ancestry qualifier [38]?
| attribute subset specifier [71]?, DATA-ATTRIBUTES, (OF, "(", qualified attribute part identifier [66], ")")?

[71] attribute subset specifier [68] [70] ::=
NON-IMPLIED
| SPECIFIED

[72] attribute alias [214] ::= markup name [34]

[73] attribute name [66] [67] [69] [192] [302] ::= markup name [34]

[74] attribute type set [79] ::=
attribute type [75]
| "(", attribute type [75], ((AND | "&"), attribute type [75])*, ")"
| "(", attribute type [75], ((OR | "|"), attribute type [75])*, ")"

[75] attribute type [74] ::=
attribute declaration type [77]
| attribute default type [78]
| attribute specification type [76]

[76] attribute specification type [75] ::=
DEFAULTED
| IMPLIED
| SPECIFIED

[77] attribute declaration type [75] ::=
CDATA
| ENTITY
| ENTITIES
| GROUP
| ID
| IDREF
| IDREFS
| NAME
| NAMES
| NOTATION
| NUMBER
| NUMBERS
| NMTOKEN
| NMTOKENS
| NUTOKEN
| NUTOKENS

[78] attribute default type [75] ::=
DECLARED-CONREF
| DECLARED-CURRENT
| DECLARED-DEFAULTED
| DECLARED-FIXED
| DECLARED-IMPLIED
| DECLARED-REQUIRED

3.4.1 Attribute Tests

[79] attribute test primary [318] ::= qualified attribute identifier [67], (IS | ISNT), attribute type set [74]

[80] attributes test primary [318] ::= qualified attribute set identifier [68], (HAS | HASNT), KEY, string primary [265]


4 Input Processing Rules

[81] input processing rule [92] ::=
find rule [83]
| find end rule [82]
| find start rule [84]
| external text entity rule [86]

[82] find end rule [81] ::= FIND-END, condition [316]?, local scope [147]

[83] find rule [81] ::= FIND, NULL?, pattern expression [326], condition [316]?, local scope [147]

[84] find start rule [81] ::= FIND-START, condition [316]?, local scope [147]

[85] extended entity name set [86] ::=
extended entity name [87]
| "(", extended entity name [87], ((OR | "|"), extended entity name [87])*, ")"

[86] external text entity rule [81] ::= EXTERNAL-TEXT-ENTITY, (extended entity name set [85] | implied entity type set [88]), condition [316]?, local scope [147]

[87] extended entity name [85] ::=
markup name [34]
| anonymous entity type [63]

[88] implied entity type set [86] ::=
#IMPLIED
| "(", (anonymous entity type [63], (OR | "|"))*, #IMPLIED, ((OR | "|"), anonymous entity type [63])*, ")"


5 Groups

[89] identified group [2] ::=
GROUP, group identification [90], group member [91]*
| GROUP, "(", group identification [90], ")", group member [91]*

[90] group identification [89] ::=
group name set [93]
| #IMPLIED

[91] group member [2] [89] ::=
common declaration [111]
| include [97]
| rule [92]

[92] rule [91] ::=
markup processing rule [7]
| input processing rule [81]
| line breaking rule [123]
| main process rule [3]
| markup error rule [19]

[93] group name set [90] [95] ::= group name [94], ((AND | "&"), group name [94])*

[94] group name [93] ::=
constant string literal [278]
| name [464]

[95] current group set [170] [193] ::=
group name set [93]
| (group name set [93], (AND | "&"))?, #GROUP, ((AND | "&"), group name set [93])?
| #IMPLIED


6 Aided-translation Types

[96] program type [2] ::=
(CONTEXT-TRANSLATE | DOWN-TRANSLATE | UP-TRANSLATE), (WITH, (SGML | XML))?
| CROSS-TRANSLATE

The aided-translation types are deprecated in favour of the more general PROCESS programs. Each aided-translation type can be simulated using a PROCESS program and a STRING SOURCE function.


7 Source-Level Components

7.1 Including Source Files

[97] include [91] ::= INCLUDE, constant string literal [278]

[98] include guard declaration [111] ::= INCLUDE-GUARD, (constant string literal [278] | name [464])

7.2 Modules

[99] module declaration [1] ::=
MODULE, (SHARED, AS, (constant string literal [278] | name [464]))?
| MODULE, INTERFACE, SHARED, AS, (constant string literal [278] | name [464])
| MODULE, IMPLEMENTS, constant string literal [278]

[100] import declaration [111] ::=
IMPORT, constant string literal [278], EXPORT?, PREFIXED, BY, name [464], use clause [101]*, supply clause [102]*
| IMPORT, constant string literal [278], EXPORT?, UNPREFIXED, use clause [101]*, supply clause [102]*
| IMPORT, constant string literal [278], ONLY, use clause [101]+, supply clause [102]*

[101] use clause [100] ::=
EXPORT?, USE, name [464], (AS, name [464])?
| EXPORT?, USE, #CONVERSION-FUNCTIONS

[102] supply clause [100] ::= SUPPLY, name [464], (AS, name [464])?

7.3 Accessing Text Files

[103] library declaration [111] ::= LIBRARY, (constant string expression [273], constant string expression [273])+


8 Declarations

[104] program-level declaration [2] ::=
default io declaration [105]
| escape declaration [106]
| main buffering declaration [107]
| main mode declaration [108]
| main output referent declaration [109]

[105] default io declaration [104] ::= DECLARE, NO-DEFAULT-IO

default io declaration [105] cannot appear in a module.

[106] escape declaration [104] [473] ::= ESCAPE, constant string primary [276]

[107] main buffering declaration [104] [109] ::= DECLARE, (#ERROR | #MAIN-INPUT | #MAIN-OUTPUT | #PROCESS-INPUT | #PROCESS-OUTPUT), HAS, (BUFFERED | UNBUFFERED)

main buffering declaration [107] cannot appear in a module.

[108] main mode declaration [104] [109] ::= DECLARE, (#MAIN-INPUT | #MAIN-OUTPUT | #PROCESS-INPUT | #PROCESS-OUTPUT), HAS, (BINARY-MODE | TEXT-MODE)

main mode declaration [108] cannot appear in a module.

[109] main output referent declaration [104] ::= DECLARE, #MAIN-OUTPUT, HAS, modifier literal for referents [430]

main output referent declaration [109] cannot appear in a module.

main buffering declaration [107], main mode declaration [108] and main output referent declaration [109] consistency is verified at compile-time. main buffering declaration [107] and main mode declaration [108] can neither be duplicated, nor contradict previously-encountered declarations. Meanwhile, only one main output referent declaration [109] is allowed per program.

[110] preamble declaration [2] ::=
common declaration [111]
| global object definition [112]
| naming declaration [115]

[111] common declaration [91] [110] ::=
binary input declaration [113]
| binary output declaration [114]
| break-width declaration [122]
| delimiter declaration [299]
| external function library declaration [146]
| import declaration [100]
| include guard declaration [98]
| library declaration [103]
| macro definition [456]
| symbol declaration [298]

[112] global object definition [110] ::=
catch definition [405]
| function definition [367]
| global shelf definition [432]
| require function definition [379]
| require shelf definition [433]
| user-defined type declaration [129]

[113] binary input declaration [111] ::= BINARY-INPUT, constant numeric expression [252]

binary input declaration [113] cannot appear in a module.

If more than one binary input declaration [113] appears in a program, their respective constant numeric expression [252] values must be equal.

[114] binary output declaration [111] ::= BINARY-OUTPUT, constant numeric expression [252]

binary output declaration [114] cannot appear in a module.

If more than one binary output declaration [114] appears in a program, their respective constant numeric expression [252] values must be equal.

8.1 Naming Declarations

[115] naming declaration [110] ::=
data letters declaration [116]
| entity namecase declaration [117]
| general namecase declaration [118]
| markup identification declaration [119]
| name letters declaration [120]
| newline declaration [121]

[116] data letters declaration [115] ::=
DECLARE, DATA-LETTERS, constant string expression [273], constant string expression [273]?
| LETTERS, constant string expression [273], constant string expression [273]?

data letters declaration [116] cannot appear in a module.

[117] entity namecase declaration [115] ::= NAMECASE, ENTITY, (YES | NO)

entity namecase declaration [117] is deprecated.

[118] general namecase declaration [115] ::= NAMECASE, GENERAL, (YES | NO)

general namecase declaration [118] is deprecated.

[119] markup identification declaration [115] ::= DECLARE, MARKUP-IDENTIFICATION, (#FULL | #BASE)

[120] name letters declaration [115] ::= DECLARE, NAME-LETTERS, constant string expression [273], constant string expression [273]

[121] newline declaration [115] ::= NEWLINE, constant string expression [273]

newline declaration [121] is considered obsolete, and is disallowed in programs with modules.

8.2 Line-breaking Declarations

[122] break-width declaration [111] ::= BREAK-WIDTH, constant numeric expression [252], (number [250] | TO, constant numeric expression [252])?

break-width declaration [122] cannot appear in a module.

[123] line breaking rule [92] ::=
insertion break rule [124]
| replacement break rule [125]

[124] insertion break rule [123] ::= INSERTION-BREAK, constant string expression [273], condition [316]?

[125] replacement break rule [123] ::= REPLACEMENT-BREAK, constant string primary [276], constant string expression [273], condition [316]?


9 Types

[126] type [368] [369] [370] [371] [372] [373] [376] [379] [384] [389] ::=
first-class type [127]
| qualified type [128]

[127] first-class type [126] [385] [387] [388] [433] [439] [443] ::=
user-defined type name [139]
| ATTRIBUTE-DECLARATION
| ATTRIBUTE-DEFAULT-DECLARATION
| ATTRIBUTE-VALUE-DECLARATION
| COUNTER
| DTD
| DECLARED-ATTRIBUTE
| ELEMENT-CONTENT-MODEL
| ELEMENT-DECLARATION
| ENTITY-DECLARATION
| IMPLIED-ATTRIBUTE
| INTEGER
| INT32
| MARKUP-EVENT
| MARKUP-POINT-EVENT
| MARKUP-REGION-EVENT
| MARKUP-COMMENT-EVENT
| MARKUP-ELEMENT-EVENT
| MARKUP-ERROR-EVENT
| MARKUP-CDATA-MARKED-SECTION-EVENT
| MARKUP-IGNORE-MARKED-SECTION-EVENT
| MARKUP-INCLUDE-MARKED-SECTION-EVENT
| MARKUP-RCDATA-MARKED-SECTION-EVENT
| MARKUP-EXTERNAL-DATA-ENTITY-REFERENCE-EVENT
| MARKUP-INTERNAL-DATA-ENTITY-REFERENCE-EVENT
| MARKUP-EXTERNAL-TEXT-ENTITY-REFERENCE-EVENT
| MARKUP-INTERNAL-TEXT-ENTITY-REFERENCE-EVENT
| MARKUP-PROCESSING-INSTRUCTION-EVENT
| MARKUP-WARNING-EVENT
| SGML-DTD
| SPECIFIED-ATTRIBUTE
| STREAM
| STRING
| SWITCH
| XML-DTD

The type INT32 is a deprecated synonym for INTEGER. Its use is discouraged.

[128] qualified type [126] ::= (MARKUP | STRING), (SINK | SOURCE)

9.1 User-Defined Types

[129] user-defined type declaration [112] ::=
opaque type declaration [130]
| record type declaration [133]
| user-defined type require [137]

[130] opaque type declaration [129] ::= (DECLARE | EXPORT), (ABSTRACT, OPAQUE, user-defined type name [139], opaque type inheritance clause [132]? | OPAQUE, user-defined type name [139], opaque type inheritance clause [132]?, opaque type declaration binding [131])

An opaque type declaration [130] with an ABSTRACT qualifier declares a so-called abstract opaque type. An abstract opaque type cannot be instantiated.

[131] opaque type declaration binding [130] ::= CREATED, BY, system-specific function name [476], (IN, FUNCTION-LIBRARY, system-specific library name [477])?

[132] opaque type inheritance clause [130] ::= EXTENDS, user-defined type name [139]

user-defined type name [139] must be an abstract opaque type.

[133] record type declaration [129] ::= (DECLARE | EXPORT, (AS, OPAQUE)?), ABSTRACT?, RECORD, user-defined type name [139], record type inheritance clause [135]?, record type declaration binding [134]

A record type declaration [133] with an ABSTRACT qualifier declares a so-called abstract record type. An abstract record type cannot be instantiated.

[134] record type declaration binding [133] ::=
field declaration [136]*
| ELSEWHERE

A record type declaration binding [134] with an ELSEWHERE clause declares a so-called restricted type. A restricted type cannot be used in all contexts that a fully-declared type can be used.

[135] record type inheritance clause [133] ::= EXTENDS, user-defined type name [139]

user-defined type name [139] must be a record type, and cannot be a restricted type.

[136] field declaration [134] ::= FIELD, shelf declaration [439]

[137] user-defined type require [129] ::= REQUIRE, OPAQUE, user-defined type name [139]

[138] record field reference [198] [214] [445] ::= user-defined type instance [143], ":", name [464]

Field dereferencing is only allowed if user-defined type instance [143] is an instance of a record type.

[139] user-defined type name [127] [130] [132] [133] [135] [137] [142] [206] [403] ::= name [464]

[140] user-defined type expression [143] [344] ::= expression [230]

[141] user-defined type subexpression [144] ::=
argument primary [400], (user-defined infix function name [472], argument primary [400])+
| user-defined type primary [142]

[142] user-defined type primary [141] ::=
user-defined type name [139], CAST, user-defined type primary [142]
| value function call [394]
| user-defined type instance [143]

[143] user-defined type instance [138] [142] ::=
shelf item reference [444]
| "(", user-defined type expression [140], ")"

[144] user-defined type test primary [318] ::= user-defined type subexpression [141], (reference comparer [145], user-defined type subexpression [141])+

[145] reference comparer [144] ::=
"=="
| "!=="

[146] external function library declaration [111] ::= DECLARE, FUNCTION-LIBRARY, constant string expression [273]


10 Actions

[147] local scope [4] [5] [6] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [82] [83] [84] [86] [199] [200] [202] [203] [206] [207] [208] [213] [216] [217] [219] [220] [325] [393] ::= local declaration [435]*, action [150]*, catch alternative [149]*, always block [148]*

[148] always block [147] ::= ALWAYS, action [150]*

[149] catch alternative [147] ::= CATCH, (built-in catch invocation [412] | catch invocation [418]), action [150]*

[150] action [147] [148] [149] ::= using prefix [191]*, guarded action [151]

[151] guarded action [150] ::= basic action [152], condition [316]?

[152] basic action [151] ::=
activate action [153]
| assert action [154]
| clear action [155]
| close action [156]
| collect garbage action [157]
| copy action [158]
| copy and clear action [159]
| deactivate action [160]
| decrement action [161]
| discard action [162]
| do action [199]
| do conditional action [200]
| do markup parse action [201]
| do scan action [202]
| do select action [203]
| do select-type action [206]
| do skip action [207]
| exit action [163]
| fail action [164]
| flush action [165]
| void function call [395]
| halt action [166]
| increment action [167]
| log-message action [168]
| new action [169]
| next group action [170]
| not reached action [171]
| open action [172]
| output action [173]
| output to action [174]
| put action [175]
| remove action [176]
| remove key action [177]
| reopen action [178]
| repeat action [208]
| repeat over action [213]
| repeat scan action [215]
| reset action [179]
| return action [180]
| set action [181]
| set external function association action [401]
| set key action [182]
| sgml in action [183]
| sgml out action [184]
| submit action [185]
| succeed action [186]
| suppress action [187]
| test system action [188]
| throw action [189]
| void action [190]

[153] activate action [152] ::= ACTIVATE, shelf item reference [444], ((AND | "&"), shelf item reference [444])*

[154] assert action [152] ::= ASSERT, boolean expression [317], (MESSAGE, expression [230])?

[155] clear action [152] ::= CLEAR, shelf reference [445], ((AND | "&"), shelf reference [445])*

[156] close action [152] ::= CLOSE, shelf item reference [444], ((AND | "&"), shelf item reference [444])*

[157] collect garbage action [152] ::= COLLECT-GARBAGE

[158] copy action [152] ::= COPY, shelf reference [445], TO, shelf reference [445]

[159] copy and clear action [152] ::= COPY-CLEAR, shelf reference [445], TO, shelf reference [445]

[160] deactivate action [152] ::= DEACTIVATE, shelf item reference [444], ((AND | "&"), shelf item reference [444])*

[161] decrement action [152] ::= DECREMENT, shelf item reference [444], (BY, numeric expression [238])?

[162] discard action [152] ::= DISCARD, shelf item reference [444], ((AND | "&"), shelf item reference [444])*

[163] exit action [152] ::= EXIT

[164] fail action [152] ::= FAIL

[165] flush action [152] ::= FLUSH, shelf item reference [444], ((AND | "&"), shelf item reference [444])*

[166] halt action [152] ::= (HALT | HALT-EVERYTHING), (WITH, numeric expression [238])?

[167] increment action [152] ::= INCREMENT, shelf item reference [444], (BY, numeric expression [238])?

[168] log-message action [152] ::= LOG-MESSAGE, string expression [260]

Previous versions of OmniMark allowed optional CLASS and SEVERITY parameters on LOG-MESSAGE. These are no longer supported.

[169] new action [152] ::=
NEW, new shelf item reference [446], ((AND | "&"), new shelf item reference [446])*
| NEW, "?", guarded new shelf item reference [447], ((AND | "&"), guarded new shelf item reference [447])*

[170] next group action [152] ::= NEXT, GROUP, IS, (current group set [95] | "(", current group set [95], ")")

[171] not reached action [152] ::= NOT-REACHED, (MESSAGE, string expression [260])?

[172] open action [152] ::= OPEN, shelf item reference [444], modifier expression [423]?, AS, string sink literal for open [365], modifier expression [423]?

A modifier expression [423] can only appear on the left-hand side or the right-hand side, but not both.

[173] output action [152] ::= OUTPUT, string source expression [361]

[174] output to action [152] ::= OUTPUT-TO, string sink expression [363]

[175] put action [152] ::= PUT, shelf item reference [444], ((AND | "&"), shelf item reference [444])*, string expression [260]

[176] remove action [152] ::= REMOVE, shelf item reference [444]

[177] remove key action [152] ::= REMOVE, KEY, OF, shelf item reference [444]

[178] reopen action [152] ::= REOPEN, shelf item reference [444], modifier expression [423]?, (AS, string sink literal for open [365], modifier expression [423]?)?

A modifier expression [423] can only appear on the left-hand side or the right-hand side, but not both.

If a right-hand side is not provided, any modifier expression [423] on the left-hand side is restricted to using the modifiers defined by modifier literal for reopen [428].

[179] reset action [152] ::= RESET, shelf item reference [444], (TO, numeric expression [238])?

[180] return action [152] ::= RETURN, expression [230]?

[181] set action [152] ::= SET, string sink primary [364], TO, expression [230]

The modifier expression [423] in string sink primary [364], if specified, is restricted to using the modifiers defined by modifier literal for set [427].

[182] set key action [152] ::= SET, KEY, OF, shelf item reference [444], TO, string expression [260]

[183] sgml in action [152] ::= SGML-IN, (string expression [260] | #NONE)

[184] sgml out action [152] ::= SGML-OUT, (string expression [260] | #NONE)

[185] submit action [152] ::= SUBMIT, string source expression [361]

[186] succeed action [152] ::= SUCCEED

[187] suppress action [152] ::= SUPPRESS

[188] test system action [152] ::= TEST-SYSTEM, (WITH, string expression [260])?

[189] throw action [152] ::= (SIGNAL, (TO, shelf item reference [444])?)?, (THROW, throw invocation [421] | RETHROW)

[190] void action [152] ::= VOID, expression [230]


11 Using

[191] using prefix [150] ::=
using attribute association prefix [192]
| using group prefix [193]
| using input prefix [194]
| using nested-referents prefix [195]
| using output prefix [196]
| using referents association prefix [197]
| using shelf item association prefix [198]

[192] using attribute association prefix [191] ::= USING, qualified attribute identifier [67], (AS, attribute name [73])?

The alias, attribute name [73], is required if the qualified attribute identifier [67] is a simple qualified attribute identifier [69] that doesn't have an ancestry qualifier [38] (if using ATTRIBUTE) and doesn't have an OF part (if using DATA-ATTRIBUTE).

[193] using group prefix [191] ::=
USING, GROUP, current group set [95]
| USING, GROUP, "(", current group set [95], ")"

[194] using input prefix [191] ::= USING, INPUT, AS, string expression [260]

[195] using nested-referents prefix [191] ::= USING, NESTED-REFERENTS

[196] using output prefix [191] ::= USING, OUTPUT, AS, string sink expression [363]

[197] using referents association prefix [191] ::= USING, REFERENTS, indexer [451]

[198] using shelf item association prefix [191] ::= USING, shelf item reference [444], (AS, shelf alias [448])?

If shelf item reference [444] contains a shelf literal [442] or a record field reference [138], the shelf alias [448] is required.


12 Block Constructs

[199] do action [152] ::= DO, local scope [147], DONE

[200] do conditional action [152] ::= DO, condition [316], local scope [147], (ELSE, condition [316], local scope [147])*, (ELSE, local scope [147], DONE)?

[201] do markup parse action [152] ::=
do generic parse action [219]
| do sgml parse action [217]
| do xml parse action [220]

[202] do scan action [152] ::= DO, SCAN, string source expression [361], match alternative [216]+, (ELSE, local scope [147])?, DONE

[203] do select action [152] ::= DO, SELECT, numeric expression [238], (CASE, constant numeric range set [204], local scope [147])+, (ELSE, local scope [147])?, DONE

[204] constant numeric range set [203] ::=
constant numeric range [205], ((OR | "|"), constant numeric range [205])*
| "(", constant numeric range [205], ((OR | "|"), constant numeric range [205])*, ")"

[205] constant numeric range [204] ::= constant numeric expression [252], (TO, constant numeric expression [252])?

[206] do select-type action [152] ::= DO, SELECT-TYPE, hierarchical type expression [344], AS, shelf alias [448], (CASE, user-defined type name [139], local scope [147])+, (ELSE, local scope [147])?, DONE

[207] do skip action [152] ::= DO, SKIP, (OVER, pattern expression [326] | PAST, numeric expression [238], (OVER, pattern expression [326])?), local scope [147], (ELSE, local scope [147])?, DONE

[208] repeat action [152] [212] ::= REPEAT, for part [209]?, from part [210]?, to part [211]?, by part [212]?, local scope [147], AGAIN

[209] for part [208] [212] ::= FOR, INTEGER, shelf alias [448]

[210] from part [208] [212] ::= FROM, numeric expression [238]

[211] to part [208] [212] ::= TO, numeric expression [238]

[212] by part [208] ::= BY, numeric expression [238]

Each optional component of the repeat action [208] has a default value should it be absent. An absent for part [209] declares an anonymous (i.e., inaccessible) alias. An absent from part [210] defaults to one. An absent to part [211] defaults to boundless. An absent by part [212] defaults to one.

[213] repeat over action [152] [325] ::= REPEAT, OVER, repeat over component [214], ((AND | "&"), repeat over component [214])*, local scope [147], AGAIN

[214] repeat over component [213] ::=
qualified attribute identifier [67], (AS, attribute alias [72])?
| qualified attribute set identifier [68], AS, attribute alias [72]
| REVERSED?, shelf reference [445], (AS, shelf alias [448])?
| REFERENTS

If shelf reference [445] is a shelf literal [442], a record field reference [138], or a reference to CURRENT ELEMENTS, the shelf alias [448] is required.

[215] repeat scan action [152] ::= REPEAT, SCAN, string expression [260], match alternative [216]+, AGAIN

[216] match alternative [202] [215] ::= MATCH, UNANCHORED?, NULL?, pattern expression [326], condition [316]?, local scope [147]

The use of UNANCHORED is deprecated in favour of the more general "**" operator.

12.1 Markup Parse Actions

[217] do sgml parse action [201] ::= DO, SGML-PARSE, sgml parse type [218], SCAN, markup parse scanning source [229], local scope [147], DONE

[218] sgml parse type [217] ::=
(DOCUMENT | SUBDOCUMENT), id checking specifier [222]?, utf8 specifier [224]?, (CREATING, sgml dtd shelf item [226])?
| INSTANCE, instance element specifier [223]?, sgml dtd specifier [225], id checking specifier [222]?, utf8 specifier [224]?

[219] do generic parse action [201] ::= DO, MARKUP-PARSE, markup source expression [359], local scope [147], DONE

[220] do xml parse action [201] ::= DO, XML-PARSE, xml parse type [221]?, SCAN, markup parse scanning source [229], local scope [147], DONE

If xml parse type [221] is not specified, the parse defaults to a well-formed XML parse.

[221] xml parse type [220] ::=
DOCUMENT, id checking specifier [222]?, utf8 specifier [224]?, (CREATING, xml dtd shelf item [228])?
| INSTANCE, (instance element specifier [223]?, xml dtd specifier [227])?, id checking specifier [222]?, utf8 specifier [224]?

[222] id checking specifier [218] [221] ::= WITH, ID-CHECKING, boolean expression [317]

[223] instance element specifier [218] [221] ::= WITH, DOCUMENT-ELEMENT, string expression [260]

[224] utf8 specifier [218] [221] ::= WITH, UTF-8, boolean expression [317]

[225] sgml dtd specifier [218] ::= WITH, (sgml dtd shelf item [226] | CURRENT, (DTD | SGML-DTD))

[226] sgml dtd shelf item [218] [225] ::= (DTDS | SGML-DTDS), key indexer [453]

[227] xml dtd specifier [221] ::= WITH, (xml dtd shelf item [228] | CURRENT, XML-DTD)

[228] xml dtd shelf item [221] [227] ::= XML-DTDS, key indexer [453]

12.1.1 Markup Parse Support

[229] markup parse scanning source [217] [220] ::=
INPUT, void function call [395]
| string source expression [361]

This particular use of the keyword INPUT is obsoleted by the introduction of string source functions. Note that with this use of the keyword INPUT, the void function call [395] must be to a void-valued function.


13 Expressions

[230] expression [140] [154] [180] [181] [190] [237] [238] [260] [317] [345] [347] [348] [349] [350] [352] [353] [354] [356] [359] [361] [363] [384] [399] [443] ::= conditional expression [231], ((OR | "|"), conditional expression [231])*

[231] conditional expression [230] ::=
conjunctive expression [232], "->", conditional expression [231], "|", conditional expression [231]
| conjunctive expression [232]

[232] conjunctive expression [231] ::= factor expression [233], ((AND | "&"), factor expression [233])*

[233] factor expression [232] ::= (NOT | "!")?, comparison expression [234]

[234] comparison expression [233] ::= subexpression [235], ((equality comparer [321], subexpression [235])+ | inequality comparer [322], subexpression [235])?

[235] subexpression [234] [239] [261] ::=
numeric term [241], (numeric additive operator [240], numeric term [241])*
| string term [262], ((JOIN | "||"), string term [262])*
| expression secondary [236]

[236] expression secondary [235] [264] ::= expression primary [237], (user-defined infix function name [472], argument primary [400])+

[237] expression primary [236] [400] ::=
ancestry expression [39]
| attribute declaration primary [351]
| attribute default declaration primary [352]
| attribute value declaration primary [353]
| attribute primary [354]
| boolean primary [318]
| content model primary [350]
| dtd primary [347]
| element declaration primary [349]
| entity declaration primary [348]
| markup event primary [346]
| markup sink primary [357]
| markup source primary [360]
| numeric primary [247]
| string primary [265]
| string sink primary [364]
| string source primary [362]
| shelf item reference [444]
| value function call [394]
| "(", expression [230], ")"

13.1 Numeric Expressions

[238] numeric expression [161] [166] [167] [179] [203] [207] [210] [211] [212] [247] [336] [452] ::= expression [230]

[239] numeric subexpression [258] [262] [263] [429] [431] ::= subexpression [235]

[240] numeric additive operator [235] [252] ::=
PLUS
| "+"
| MINUS
| "-"
| UNION
| DIFFERENCE

[241] numeric term [235] ::= numeric factor [243], (numeric multiplicative operator [242], numeric factor [243])*

[242] numeric multiplicative operator [241] [253] ::=
TIMES
| "*"
| DIVIDE
| "/"
| MODULO
| MASK
| SHIFT

[243] numeric factor [241] ::= numeric tertiary [244], ("**", numeric factor [243])?

[244] numeric tertiary [243] ::=
numeric secondary [246]
| string secondary [264], (numeric conversion operator [245], numeric secondary [246])?

[245] numeric conversion operator [244] [255] ::=
BASE
| BINARY

[246] numeric secondary [244] ::=
argument primary [400], (user-defined infix function name [472], argument primary [400])+
| numeric primary [247]

[247] numeric primary [237] [246] ::=
value function call [394]
| string primary [265]
| (NEGATE | "-"), numeric primary [247]
| COMPLEMENT, numeric primary [247]
| shelf item reference [444]
| BINARY, string primary [265]
| CHILDREN, ancestry qualifier [38]?
| ITEM, OF, item-of reference [248]
| LENGTH, OF, string primary [265]
| (NUMBER, OF | NUMBER-OF), number-of reference [249]
| OCCURRENCE, ancestry qualifier [38]?
| SYSTEM-CALL, string primary [265]
| number [250]
| "(", numeric expression [238], ")"

[248] item-of reference [247] ::=
shelf item reference [444]
| simple qualified attribute set identifier [70], key indexer [453]
| REFERENTS, key indexer [453]
| THIS, REFERENT

[249] number-of reference [247] ::=
qualified attribute identifier [67]
| qualified attribute set identifier [68]
| shelf reference [445]
| CURRENT, SUBDOCUMENTS
| REFERENTS

[250] number [122] [247] [256] [283] [284] [301] [302] [303] [306] [307] [311] [312] [314] [315] [431] [463] [475] ::= natural number [251], (".", natural number [251])?

[251] natural number [250] ::= digit [466]+, ("_", digit [466]+)*

13.1.1 Constant Numeric Expressions

[252] constant numeric expression [113] [114] [122] [205] [256] [275] [440] [441] ::= constant numeric term [253], (numeric additive operator [240], constant numeric term [253])*

[253] constant numeric term [252] ::= constant numeric factor [254], (numeric multiplicative operator [242], constant numeric factor [254])*

[254] constant numeric factor [253] ::= constant numeric secondary [255], ("**", constant numeric factor [254])?

[255] constant numeric secondary [254] ::=
constant numeric primary [256]
| constant string primary [276], numeric conversion operator [245], constant numeric primary [256]

[256] constant numeric primary [255] [274] ::=
constant string primary [276]
| (NEGATE | "-"), constant numeric primary [256]
| COMPLEMENT, constant numeric primary [256]
| BINARY, constant string primary [276]
| LENGTH, OF, constant string primary [276]
| number [250]
| "(", constant numeric expression [252], ")"

13.1.2 Numeric Tests

[257] numeric test primary [318] ::= VALUE?, numeric comparison [258]

The keyword VALUE is unnecessary in this context, and its use is deprecated.

[258] numeric comparison [257] ::= numeric subexpression [239], (comparer [319], numeric subexpression [239])+

13.1.3 Built-In Numeric Shelves

[259] built-in read-only numeric shelf name [450] ::=
#CLASS
| #ERROR-CODE
| #ITEM
| #LINE-NUMBER
| #MARKUP-ERROR-COUNT
| #MARKUP-ERROR-TOTAL
| #MARKUP-WARNING-COUNT
| #MARKUP-WARNING-TOTAL
| #SGML-ERROR-COUNT
| #SGML-ERROR-TOTAL
| #SGML-WARNING-COUNT
| #SGML-WARNING-TOTAL

13.2 String Expressions

[260] string expression [168] [171] [175] [182] [183] [184] [188] [194] [215] [223] [265] [289] [430] [453] ::= expression [230]

[261] string subexpression [289] [290] ::= subexpression [235]

[262] string term [235] ::=
string factor [263], ((REPEATED | "||*"), numeric subexpression [239])*
| string factor [263], TAKE, UNANCHORED?, pattern secondary [330]
| string factor [263], DROP, UNANCHORED?, pattern secondary [330]

The use of UNANCHORED is deprecated in favour of the more general "**" operator.

[263] string factor [262] ::= string secondary [264], ((FORMAT | "%"), numeric subexpression [239])*

[264] string secondary [244] [263] ::=
expression secondary [236]
| string primary [265]

[265] string primary [32] [80] [237] [247] [264] [266] [291] [331] [346] [349] [352] [354] [366] [455] ::=
stream input/output mode [268]?, value function call [394]
| constant string value [277]
| external function association enquiry [402]
| pattern name [333]
| qualified attribute part identifier [66]
| referent item reference [266]
| shelf item reference [444]
| stream input/output mode [268]?, FILE, string primary [265]
| DATE, string primary [265]
| KEY, OF, key-of reference [267]
| NAME, OF, shelf item reference [444]
| NAME, OF, element declaration primary [349]
| NAME, ancestry qualifier [38]
| XMLNS-NAME, ancestry qualifier [38]?
| "~", string primary [265]
| string literal [269]
| "(", string expression [260], ")"

[266] referent item reference [265] [366] ::=
REFERENTS, indexer [451]
| THIS, REFERENT
| REFERENT, string primary [265]
| SILENT-REFERENT, string primary [265]

[267] key-of reference [265] ::=
qualified attribute identifier [67]
| shelf item reference [444]
| REFERENTS, item indexer [452]
| THIS, REFERENT

[268] stream input/output mode [265] ::=
(BUFFERED | UNBUFFERED), (TEXT-MODE | BINARY-MODE)?
| (TEXT-MODE | BINARY-MODE), (BUFFERED | UNBUFFERED)?

13.2.1 String Literals

[269] string literal [265] [331] [463] ::= string literal part [270], ("_", string literal part [270])*

[270] string literal part [269] ::=
double-quoted string literal part [271]
| single-quoted string literal part [272]

[271] double-quoted string literal part [270] ::= """, (described character [283] | described substring [284] | escaped text [282] | format item [300] | unescaped character [474] | "'")*, """

[272] single-quoted string literal part [270] ::= "'", (described character [283] | described substring [284] | escaped text [282] | format item [300] | unescaped character [474] | """)*, "'"

13.2.2 Constant String Expressions

[273] constant string expression [103] [116] [120] [121] [124] [125] [146] [276] [298] [299] [476] [477] ::= constant string term [274], ((JOIN | "||"), constant string term [274])*

[274] constant string term [273] ::= constant string factor [275], ((REPEATED | "||*"), constant numeric primary [256])?

[275] constant string factor [274] ::= constant string primary [276], ((FORMAT | "%"), (constant numeric expression [252] | constant string primary [276]))*

[276] constant string primary [106] [125] [255] [256] [275] [277] ::=
constant string value [277]
| constant string literal [278]
| "(", constant string expression [273], ")"

[277] constant string value [265] [276] ::= COMPILED-DATE, constant string primary [276]

[278] constant string literal [34] [94] [97] [98] [99] [100] [276] [341] [429] [464] ::= constant string literal part [279], ("_", constant string literal part [279])*

[279] constant string literal part [278] ::=
double-quoted constant string literal part [280]
| single-quoted constant string literal part [281]

[280] double-quoted constant string literal part [279] ::= """, (described character [283] | described substring [284] | escaped text [282] | unescaped character [474] | "'")*, """

[281] single-quoted constant string literal part [279] ::= "'", (described character [283] | described substring [284] | escaped text [282] | unescaped character [474] | """)*, "'"

[282] escaped text [271] [272] [280] [281] ::= escape [473], (escape [473] | """ | "'" | "#" | ")")

[283] described character [271] [272] [280] [281] ::=
escape [473], "_"
| escape [473], "n"
| escape [473], "t"
| escape [473], number [250], "#"

[284] described substring [271] [272] [280] [281] [475] ::= escape [473], number [250], "r", "{", describing number [475], (",", describing number [475])*, "}"

13.2.3 Stream Tests

[285] stream test primary [318] ::=
shelf item reference [444], (HAS | HASNT), NAME
| shelf item reference [444], (IS | ISNT), stream type set [286]

[286] stream type set [285] ::=
stream type [287]
| "(", stream type [287], ((AND | "&"), stream type [287])*, ")"
| "(", stream type [287], ((OR | "|"), stream type [287])*, ")"

[287] stream type [286] ::=
ATTACHED
| BUFFER
| CLOSED
| EXTERNAL
| FILE
| MARKUP-PARSER
| OPEN
| REFERENT
| SGML-PARSER

SGML-PARSER is deprecated in favour of the more general MARKUP-PARSER.

13.2.4 String Tests

[288] string test primary [318] ::=
string comparison [289]
| string match test primary [290]

[289] string comparison [288] ::= string subexpression [261], (comparer [319], UL?, string subexpression [261])*, (comparer [319], UL?, (string subexpression [261] | "(", string expression [260], ((OR | "|"), string expression [260])*, ")"))*

[290] string match test primary [288] ::= string subexpression [261], MATCHES, UNANCHORED?, pattern secondary [330]

The use of UNANCHORED is deprecated in favour of the more general "**" operator.

13.2.5 Source Tests

[291] source test primary [318] ::=
FILE, string primary [265], EXISTS
| FILE, string primary [265], (IS | ISNT), file info enquiry set [292]
| #CURRENT-INPUT, (IS | ISNT), ATTACHED

[292] file info enquiry set [291] ::=
file info enquiry [293]
| "(", file info enquiry [293], ((AND | "&"), file info enquiry [293])*, ")"

[293] file info enquiry [292] ::=
DIRECTORY
| FILE
| READABLE
| WRITABLE

13.2.6 Built-In Stream Shelves

[294] built-in write-only stream shelf name [450] ::=
#CONSOLE
| #CURRENT-OUTPUT
| #ERROR
| #LOG
| #MAIN-OUTPUT
| #MARKUP-PARSER
| #OUTPUT
| #PROCESS-OUTPUT
| #SGML
| #UNATTACHED
| SGML

The use of the SGML and #SGML keywords is deprecated in favour of #MARKUP-PARSER.

The use of the #OUTPUT keyword is deprecated in favour of #CURRENT-OUTPUT.

[295] built-in read-only stream shelf name [450] ::=
#ADDITIONAL-INFO
| #APPINFO
| #ARGS
| #COMMAND-LINE-NAMES
| #DOCTYPE
| #FILE-NAME
| #LANGUAGE-VERSION
| #MESSAGE
| #PLATFORM-INFO
| #RECOVERY-INFO
| #XMLNS-NAMES

[296] built-in read-write stream shelf name [450] ::=
#LIBPATH
| #LIBRARY
| #LIBVALUE

[297] built-in string source name [362] ::=
#CURRENT-INPUT
| #MAIN-INPUT
| #PROCESS-INPUT

13.2.7 Formatting Declarations

[298] symbol declaration [111] ::= SYMBOL, constant string expression [273]+

symbol declaration [298] cannot be appear in a module.

[299] delimiter declaration [111] ::= DELIMITER, constant string expression [273]

delimiter declaration [299] cannot be appear in a module.

13.2.8 Format Items

[300] format item [271] [272] ::=
alphabetic format item [301]
| attribute format item [302]
| binary format item [303]
| break format item [304]
| content format item [305]
| current name format item [306]
| decimal format item [307]
| end break suppress format item [308]
| macro format item [309]
| other format item [310]
| pattern format item [311]
| roman format item [312]
| start break suppress format item [313]
| stream format item [314]
| symbol format item [315]

[301] alphabetic format item [300] ::= escape [473], (number [250], "f" | "j" | "k" | "l" | "u" | "w")*, "a", "(", shelf item reference [444], ")"

[302] attribute format item [300] ::= escape [473], (number [250], "f" | "k" | "e" | "h" | "l" | "o" | "p" | "s" | "u" | "z")*, "v", "(", attribute name [73], ")"

[303] binary format item [300] ::= escape [473], (number [250], "f" | number [250])*, "b", "(", shelf item reference [444], ")"

[304] break format item [300] ::= escape [473], "/"

[305] content format item [300] ::= escape [473], ("h" | "l" | "s" | "u" | "z")*, "c"

[306] current name format item [300] ::= escape [473], ("e" | number [250], "f" | "k" | "l" | "o" | "p" | "u")*, "q"

[307] decimal format item [300] ::= escape [473], (number [250], "f" | ("k" | "z") | "l" | number [250], "r" | "s" | "u" | number [250])*, "d", "(", shelf item reference [444], ")"

[308] end break suppress format item [300] ::= escape [473], "]"

[309] macro format item [300] ::= escape [473], ("u" | "l")?, "@", (escape [473] | "(", name [464], ")")

[310] other format item [300] ::=
escape [473], "s", "_"
| escape [473], "s", "n"
| escape [473], "s", "t"
| escape [473], "e", "n"

[311] pattern format item [300] ::= escape [473], (number [250], "f" | "k" | "h" | "l" | "s" | "u")*, "x", "(", pattern name [333], ")"

pattern format item [311] is deprecated in favour of stream format item [314].

[312] roman format item [300] ::= escape [473], (number [250], "f" | "k" | "l" | "u")*, "i", "(", shelf item reference [444], ")"

[313] start break suppress format item [300] ::= escape [473], "["

[314] stream format item [300] [311] ::= escape [473], (number [250], "f" | "k" | "l" | "u" | "e")*, "g", "(", (shelf item reference [444] | pattern name [333]), ")"

[315] symbol format item [300] ::= escape [473], (number [250], "f" | "k")*, "y", "(", shelf item reference [444], ")"

13.3 Boolean Expressions

[316] condition [4] [5] [6] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [82] [83] [84] [86] [124] [125] [151] [200] [216] [331] ::= (WHEN | UNLESS), boolean expression [317]

[317] boolean expression [154] [222] [224] [316] [318] ::= expression [230]

[318] boolean primary [237] [331] [351] ::=
shelf item reference [444]
| value function call [394]
| FALSE
| TRUE
| "~", boolean primary [318]
| argument test primary [404]
| attribute test primary [79]
| attributes test primary [80]
| catch test primary [422]
| element test primary [42]
| entity test primary [52]
| numeric test primary [257]
| pattern test primary [343]
| shelf test primary [455]
| source test primary [291]
| stream test primary [285]
| string test primary [288]
| user-defined type test primary [144]
| ACTIVE, boolean primary [318]
| "(", boolean expression [317], ")"

Use of the ACTIVE keyword is unnecessary and is deprecated.

[319] comparer [258] [289] ::=
equivalence comparer [320]
| ascending comparer [323]
| descending comparer [324]

[320] equivalence comparer [52] [319] ::=
equality comparer [321]
| inequality comparer [322]

[321] equality comparer [234] [320] ::=
IS, EQUAL
| "="

[322] inequality comparer [234] [320] ::=
ISNT, EQUAL
| "!", "="

[323] ascending comparer [319] ::=
IS, LESS-EQUAL
| ISNT, GREATER-THAN
| "<="
| IS, LESS-THAN
| ISNT, GREATER-EQUAL
| "<"

[324] descending comparer [319] ::=
IS, GREATER-EQUAL
| ISNT, LESS-THAN
| ">="
| IS, GREATER-THAN
| ISNT, LESS-EQUAL
| ">"

13.3.1 Built-In Switch Shelves

[325] built-in read-only switch shelf name [450] ::=
#FIRST
| #LAST
| #FTRACE-IS-EMITTED

#FIRST and #LAST are available only within the local scope [147] of a repeat over action [213].

13.4 Pattern Expressions

[326] pattern expression [24] [26] [83] [207] [216] [331] ::= pattern product [327], ((OR | "|"), pattern product [327])*

[327] pattern product [326] ::=
pattern factor [328], pattern product [327]?
| pattern prefix modifier [332]*, pattern product [327]
| (character set [338] | character class name [337]), ("**" | "++"), ("=>", pattern name [333])?, pattern product [327]

[328] pattern factor [327] ::=
(pattern entity type [334] | pattern nonentity type [335])?, pattern tertiary [329]
| pattern entity type [334], NAMED, pattern tertiary [329], (VALUED, pattern tertiary [329])?
| pattern entity type [334], VALUED, pattern tertiary [329], (NAMED, pattern tertiary [329])?

[329] pattern tertiary [328] ::= pattern prefix modifier [332]*, pattern secondary [330], ("=>", pattern name [333])?

[330] pattern secondary [262] [290] [329] ::= pattern primary [331], occurrence indicator [336]?

[331] pattern primary [330] ::=
character class name [337]
| character set [338]
| string literal [269]
| positional pattern [342]
| ANOTHER?, pattern name [333]
| value function call [394]
| "~", string primary [265]
| "~", boolean primary [318]
| "(", condition [316], ")"
| "(", pattern expression [326], condition [316]?, ")"

[332] pattern prefix modifier [327] [329] ::=
LOOKAHEAD
| LOOKAHEAD, NOT
| UL

[333] pattern name [265] [311] [314] [327] [329] [331] [343] ::= name [464]

[334] pattern entity type [328] ::=
CDATA
| SDATA
| ENTITY

[335] pattern nonentity type [328] ::=
PCDATA
| NON-CDATA
| NON-SDATA
| TEXT

[336] occurrence indicator [330] ::=
"?"
| "+"
| "*"
| "{", numeric expression [238], "}"
| "{", numeric expression [238], TO, numeric expression [238], "}"
| "{", numeric expression [238], "}", "+"

[337] character class name [327] [331] [341] ::=
ANY
| ANY-TEXT
| BLANK
| DIGIT
| LC
| LETTER
| SPACE
| UC
| WHITE-SPACE

[338] character set [327] [331] ::=
"[", character set term [340], (character set exception operator [339], character set term [340])?, "]"
| "[", character set exception operator [339], character set term [340], "]"

[339] character set exception operator [338] ::=
"\"
| EXCEPT

[340] character set term [338] ::= character set product [341], ((OR | "|"), character set product [341])*

[341] character set product [340] ::=
character class name [337]
| constant string literal [278], (TO, constant string literal [278])?

[342] positional pattern [331] ::=
CONTENT-END
| CONTENT-START
| LINE-END
| LINE-START
| VALUE-END
| VALUE-START
| WORD-END
| WORD-START

13.4.1 Pattern Tests

[343] pattern test primary [318] ::= pattern name [333], (IS | ISNT), SPECIFIED

[344] hierarchical type expression [206] ::=
markup event expression [345]
| user-defined type expression [140]

13.5 Markup Events

[345] markup event expression [344] [346] ::= expression [230]

[346] markup event primary [40] [237] [349] [421] [445] ::=
built-in read-only markup-event shelf name [37]
| CREATE-ELEMENT-EVENT, element declaration primary [349], (ATTRIBUTES, shelf reference [445])?
| CREATE-PROCESSING-INSTRUCTION-EVENT, string primary [265]
| shelf item reference [444]
| value function call [394]
| "(", markup event expression [345], ")"

13.6 Markup Declarations

[347] dtd primary [237] [348] [349] ::=
built-in read-only dtd shelf name [35]
| shelf item reference [444]
| value function call [394]
| "(", expression [230], ")"

[348] entity declaration primary [237] ::=
DECLARED-GENERAL-ENTITIES, OF, dtd primary [347]
| DECLARED-PARAMETER-ENTITIES, OF, dtd primary [347]
| shelf item reference [444]
| value function call [394]
| "(", expression [230], ")"

[349] element declaration primary [237] [265] [346] [350] [351] [353] ::=
CREATE-ELEMENT-DECLARATION, string primary [265], ATTRIBUTES, shelf reference [445], CONTENT, content model primary [350]
| DECLARATION, OF, markup event primary [346]
| DECLARED-ELEMENTS, OF, dtd primary [347]
| shelf item reference [444]
| value function call [394]
| "(", expression [230], ")"

[350] content model primary [237] [349] ::= (ELEMENT-CONTENT-MODEL | MIXED-CONTENT-MODEL | ANY-CONTENT-MODEL | EMPTY-CONTENT-MODEL | CDATA-CONTENT-MODEL | RCDATA-CONTENT-MODEL | CONTENT, OF, element declaration primary [349] | shelf item reference [444] | value function call [394] | "(", expression [230], ")")

[351] attribute declaration primary [237] [354] ::= (CREATE-ATTRIBUTE-DECLARATION, attribute value declaration primary [353], DEFAULT, attribute default declaration primary [352], (CASE-SENSITIVE, boolean primary [318])? | ATTRIBUTES, OF, element declaration primary [349])

[352] attribute default declaration primary [237] [351] ::= (ATTRIBUTE-DECLARED-CURRENT | ATTRIBUTE-DECLARED-CONREF | ATTRIBUTE-DECLARED-DEFAULTED, TO, string primary [265] | ATTRIBUTE-DECLARED-FIXED, TO, string primary [265] | ATTRIBUTE-DECLARED-IMPLIED | ATTRIBUTE-DECLARED-REQUIRED | shelf item reference [444] | value function call [394] | "(", expression [230], ")")

[353] attribute value declaration primary [237] [351] ::= (ATTRIBUTE-DECLARED-CDATA | ATTRIBUTE-DECLARED-ENTITY | ATTRIBUTE-DECLARED-ENTITIES | ATTRIBUTE-DECLARED-GROUP, shelf reference [445] | ATTRIBUTE-DECLARED-ID | ATTRIBUTE-DECLARED-IDREF | ATTRIBUTE-DECLARED-IDREFS | ATTRIBUTE-DECLARED-NAME | ATTRIBUTE-DECLARED-NAMES | ATTRIBUTE-DECLARED-NMTOKEN | ATTRIBUTE-DECLARED-NMTOKENS | ATTRIBUTE-DECLARED-NUMBER | ATTRIBUTE-DECLARED-NUMBERS | ATTRIBUTE-DECLARED-NUTOKEN | ATTRIBUTE-DECLARED-NUTOKENS | ATTRIBUTE-DECLARED-NOTATION | ATTRIBUTES, OF, element declaration primary [349] | shelf item reference [444] | value function call [394] | "(", expression [230], ")")

[354] attribute primary [237] ::=
qualified attribute part identifier [66]
| CREATE-SPECIFIED-ATTRIBUTE, attribute declaration primary [351], FROM, string primary [265]
| CREATE-UNSPECIFIED-ATTRIBUTE, attribute declaration primary [351]
| shelf item reference [444]
| value function call [394]
| "(", expression [230], ")"

13.7 Stream Expressions

[355] stream expression ::= shelf item reference [444]

13.8 Markup Sink Expressions

[356] markup sink expression [357] ::= expression [230]

[357] markup sink primary [237] ::=
built-in markup sink name [358]
| value function call [394]
| "(", markup sink expression [356], ")"

[358] built-in markup sink name [357] ::= #SUPPRESS

13.9 Markup Source Expressions

[359] markup source expression [219] [360] ::= expression [230]

[360] markup source primary [237] ::=
built-in markup source name [36]
| value function call [394]
| "(", markup source expression [359], ")"

13.10 String Source Expressions

[361] string source expression [173] [185] [202] [229] [362] ::= expression [230]

[362] string source primary [237] ::=
built-in string source name [297]
| value function call [394]
| "(", string source expression [361], ")"

13.11 String Sink Expressions

[363] string sink expression [174] [196] ::= expression [230]

[364] string sink primary [181] [237] ::=
shelf item reference [444], modifier expression [423]?
| string sink literal [366], modifier expression [423]?

The modifier expression [423], if specified, is restricted to using the modifiers defined by modifier literal for content [429].

[365] string sink literal for open [172] [178] [366] ::=
string sink literal [366]
| BUFFER

[366] string sink literal [364] [365] ::=
FILE, string primary [265]
| REFERENT, string primary [265]
| THIS, REFERENT
| value function call [394]

The use of the FILE keyword is optional in some contexts; however its omission is deprecated in those contexts.

When THIS REFERENT appears in string sink literal for open [365], it is interpreted as a referent item reference [266], unless preceded by the FILE keyword.

The value function call [394] must be a STRING SINK-valued function.


14 Functions

14.1 Function Definition

[367] function definition [112] ::=
external prefix function definition [368]
| external infix function definition [369]
| external conversion function definition [370]
| internal prefix function definition [371]
| internal infix function definition [372]
| internal conversion function definition [373]

[368] external prefix function definition [367] [388] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, shelf class [386]?, type [126]?, prefix function signature definition [375], external function binding [392]

[369] external infix function definition [367] [388] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, type [126], infix function signature definition [376], external function binding [392]

[370] external conversion function definition [367] [388] ::= (DEFINE | EXPORT), EXTERNAL, type [126], conversion function signature definition [377], external function binding [392]

[371] internal prefix function definition [367] [388] ::= (DEFINE | EXPORT), function categorization kind [374]?, shelf class [386]?, type [126]?, prefix function signature definition [375], internal function binding [393]

[372] internal infix function definition [367] [388] ::= (DEFINE | EXPORT), OVERLOADED?, type [126], infix function signature definition [376], internal function binding [393]

[373] internal conversion function definition [367] [388] ::= (DEFINE | EXPORT), type [126], conversion function signature definition [377], internal function binding [393]

[374] function categorization kind [371] ::=
DYNAMIC?, OVERLOADED
| OVERRIDING

[375] prefix function signature definition [368] [371] ::= FUNCTION, prefix function name [468], function argument list definition [380]?

[376] infix function signature definition [369] [372] ::= INFIX-FUNCTION, VALUE, type [126], name [464], infix function name [467], VALUE, type [126], name [464]

[377] conversion function signature definition [370] [373] ::= CONVERSION-FUNCTION, function argument definition [383]

[378] function name [379] [403] ::= name [464]

[379] require function definition [112] ::= REQUIRE, type [126]?, FUNCTION, function name [378], function argument list definition [380]?

[380] function argument list definition [375] [379] ::=
parenthesized function argument list definition [381]
| unparenthesized function argument list definition [382]

[381] parenthesized function argument list definition [380] ::=
"(", ")"
| "(", function argument definition [383], (argument separator [390], function argument definition [383])*, (argument separator [390], remainder argument definition [387], (argument separator [390], ".", ".", ".")?, ")")?
| "(", remainder argument definition [387], argument separator [390], ".", ".", ".", ")"

[382] unparenthesized function argument list definition [380] ::=
argument herald [391]?, function argument definition [383], (argument herald [391], function argument definition [383])*, (argument herald [391], remainder argument definition [387], (argument herald [391], ".", ".", ".")?)?
| argument herald [391], remainder argument definition [387], (argument herald [391], ".", ".", ".")?
| remainder argument definition [387], argument herald [391], ".", ".", "."

[383] function argument definition [377] [381] [382] ::=
expression argument definition [384]
| shelf class argument definition [385]
| converting argument definition [388]

[384] expression argument definition [383] [411] ::= VALUE, type [126], name [464], (OPTIONAL, (INITIAL, "{", expression [230], "}")?)?

[385] shelf class argument definition [383] [411] ::= shelf class [386], first-class type [127], name [464], (OPTIONAL, (INITIAL, shelf literal [442])?)?

[386] shelf class [368] [371] [385] [445] ::=
MODIFIABLE
| READ-ONLY
| WRITE-ONLY

[387] remainder argument definition [381] [382] ::= REMAINDER, first-class type [127], name [464]

[388] converting argument definition [383] ::= VALUE, "(", (ANY | source type name [389], ((OR | "|"), source type name [389])*), INTO, first-class type [127], ")", name [464]

A converting argument definition [388] is only allowed as the first argument of an OVERLOADED external prefix function definition [368] or internal prefix function definition [371], as an argument of an OVERLOADED external infix function definition [369] or internal infix function definition [372], or as the argument of an external conversion function definition [370] or internal conversion function definition [373].

[389] source type name [388] ::=
type [126]
| NUMERIC-LITERAL

[390] argument separator [381] [396] [409] [419] ::=
argument herald [391]
| ","

[391] argument herald [382] [390] [397] [398] [410] [420] ::= name [464]

[392] external function binding [368] [369] [370] ::= AS, system-specific function name [476], (IN, FUNCTION-LIBRARY, system-specific library name [477])?

[393] internal function binding [371] [372] [373] ::=
AS, local scope [147]
| ELSEWHERE

14.2 Function Invocation

[394] value function call [142] [237] [247] [265] [318] [331] [346] [347] [348] [349] [350] [352] [353] [354] [357] [360] [362] [366] [445] ::=
prefix function name [468], parenthesized call arguments [396]
| prefix function name [468], unparenthesized call arguments [397]

[395] void function call [152] [229] ::=
prefix function name [468], parenthesized call arguments [396]
| prefix function name [468], void unparenthesized call arguments [398]

[396] parenthesized call arguments [394] [395] [421] ::= "(", (argument expression [399], (argument separator [390], argument expression [399])*)?, ")"

[397] unparenthesized call arguments [394] [421] ::= (argument herald [391]?, argument primary [400], (argument herald [391], argument primary [400])*)?

[398] void unparenthesized call arguments [395] ::= (argument herald [391]?, argument expression [399], (argument herald [391], argument expression [399])*)?

[399] argument expression [396] [398] ::= expression [230]

[400] argument primary [141] [236] [246] [397] ::= expression primary [237]

14.3 External Function Associations

[401] set external function association action [152] ::=
SET, external function identification [403], TO, system-specific function name [476]
| SET, FUNCTION-LIBRARY, OF, external function identification [403], TO, system-specific library name [477]

[402] external function association enquiry [265] ::= (FUNCTION-LIBRARY, OF)?, external function identification [403]

[403] external function identification [401] [402] ::=
(EXTERNAL-FUNCTION | EXTERNAL-OUTPUT-FUNCTION), function name [378]
| CREATOR, OF, user-defined type name [139]

The use of EXTERNAL-OUTPUT-FUNCTION is deprecated in favour of EXTERNAL-FUNCTION.

14.4 Function Argument Tests

[404] argument test primary [318] ::= shelf reference [445], (IS | ISNT), SPECIFIED


15 Catch and Throw

15.1 Catch Definitions

[405] catch definition [112] ::= (DECLARE | EXPORT | REQUIRE), catch signature [406]

[406] catch signature [405] ::= CATCH, catch name [407], catch argument list definition [408]?

[407] catch name [406] [418] [421] [422] ::= name [464]

[408] catch argument list definition [406] ::=
parenthesized catch argument list definition [409]
| unparenthesized catch argument list definition [410]

[409] parenthesized catch argument list definition [408] ::=
"(", ")"
| "(", catch argument definition [411], (argument separator [390], catch argument definition [411])*, ")"

[410] unparenthesized catch argument list definition [408] ::= argument herald [391]?, catch argument definition [411], (argument herald [391], catch argument definition [411])*

[411] catch argument definition [409] [410] ::=
expression argument definition [384]
| shelf class argument definition [385]

15.2 Throws

[412] built-in catch invocation [149] ::=
external-exception invocation [413]
| program-error invocation [414]
| markup-start invocation [415]
| markup-end invocation [416]
| markup-point invocation [417]

[413] external-exception invocation [412] ::= #EXTERNAL-EXCEPTION, (IDENTITY, name [464])?, (MESSAGE, name [464])?, (LOCATION, name [464])?

All three arguments to external-exception invocation [413] are strings.

[414] program-error invocation [412] ::= #PROGRAM-ERROR, (CODE, name [464])?, (MESSAGE, name [464])?, (LOCATION, name [464])?

The first argument to program-error invocation [414] is the numeric error code.

[415] markup-start invocation [412] ::= #MARKUP-START, name [464]

The argument to markup-start invocation [415] is the event record instance, of type MARKUP-EVENT.

[416] markup-end invocation [412] ::= #MARKUP-END, name [464]

The argument to markup-end invocation [416] is the event record instance, of type MARKUP-EVENT.

[417] markup-point invocation [412] ::= #MARKUP-POINT, name [464]

The argument to markup-point invocation [417] is the event record instance, of type MARKUP-EVENT.

[418] catch invocation [149] ::=
catch name [407], parenthesized invocation arguments [419]
| catch name [407], unparenthesized invocation arguments [420]

[419] parenthesized invocation arguments [418] ::= "(", (name [464], (argument separator [390], name [464])*)?, ")"

[420] unparenthesized invocation arguments [418] ::= (argument herald [391]?, name [464], (argument herald [391], name [464])*)?

[421] throw invocation [189] ::=
catch name [407], parenthesized call arguments [396]
| catch name [407], unparenthesized call arguments [397]
| #MARKUP-START, markup event primary [346]
| #MARKUP-END, markup event primary [346]
| #MARKUP-POINT, markup event primary [346]

15.3 Catch Tests

[422] catch test primary [318] ::= (catch name [407] | #EXTERNAL-EXCEPTION | #PROGRAM-ERROR | #MARKUP-START | #MARKUP-END | #MARKUP-POINT), (IS | ISNT), (CATCHABLE | THROWN)


16 Stream Modifiers

[423] modifier expression [172] [178] [181] [364] ::=
WITH, modifier literal [425], (WITH, modifier literal [425])*
| WITH, modifier subexpression [424]

[424] modifier subexpression [423] ::= "(", modifier literal [425], ((AND | "&"), modifier literal [425])*, ")"

[425] modifier literal [423] [424] ::= modifier literal for open [426]

[426] modifier literal for open [425] ::=
modifier literal for set [427]
| BINARY-MODE
| BUFFERED
| TEXT-MODE
| UNBUFFERED

[427] modifier literal for set [181] [426] ::=
modifier literal for reopen [428]
| APPEND

[428] modifier literal for reopen [178] [427] ::=
modifier literal for content [429]
| modifier literal for referents [430]
| modifier literal for break-width [431]

[429] modifier literal for content [364] [428] ::=
constant string literal [278]
| BINARY, numeric subexpression [239]
| DOMAIN-FREE

The DOMAIN-FREE modifier is deprecated, and its use has no effect.

[430] modifier literal for referents [109] [428] ::=
REFERENTS-ALLOWED, (DEFAULTING, "{", string expression [260], (",", string expression [260])?, "}")?
| REFERENTS-DISPLAYED
| REFERENTS-NOT-ALLOWED

[431] modifier literal for break-width [428] ::= BREAK-WIDTH, numeric subexpression [239], (number [250] | TO, numeric subexpression [239])?


17 Shelves

17.1 Shelf Definitions

[432] global shelf definition [112] ::= EXPORT?, global shelf class [434], shelf declaration [439], ((AND | "&"), shelf declaration [439])*

[433] require shelf definition [112] ::= REQUIRE, global shelf class [434], first-class type [127], shelf name [449]

[434] global shelf class [432] [433] ::=
CONSTANT
| DOMAIN-BOUND?, GLOBAL

[435] local declaration [147] ::=
global shelf save declaration [436]
| groups save declaration [437]
| local shelf declaration [438]

[436] global shelf save declaration [435] ::= (SAVE | SAVE-CLEAR), shelf name [449], ((AND | "&"), shelf name [449])*

[437] groups save declaration [435] ::= SAVE, GROUPS

[438] local shelf declaration [435] ::= LOCAL, shelf declaration [439], ((AND | "&"), shelf declaration [439])*

[439] shelf declaration [136] [432] [438] [443] ::= first-class type [127], shelf alias [448], (fixed-size shelf declaration [441] | variable-size shelf declaration [440])?, (INITIAL, shelf literal [442])?

[440] variable-size shelf declaration [439] ::= VARIABLE, (TO, constant numeric expression [252])?, (INITIAL-SIZE, constant numeric expression [252])?

[441] fixed-size shelf declaration [439] ::= SIZE, constant numeric expression [252]

[442] shelf literal [198] [214] [385] [439] [443] [445] ::= "{", shelf literal item [443], (",", shelf literal item [443])*, "}"

[443] shelf literal item [442] ::= (expression [230] | UNATTACHED), (WITH, KEY, expression [230])?

When a shelf literal [442] appears in a shelf declaration [439], the number of initializers in expression [230] must match the declared size of the shelf, if any.

When a shelf literal [442] appears in a weak context, it must be preceded by a first-class type [127] herald.

The special literal UNATTACHED can only be used in the initializer for a STREAM shelf.

17.2 Shelf References

[444] shelf item reference [143] [153] [156] [160] [161] [162] [165] [167] [172] [175] [176] [177] [178] [179] [182] [189] [198] [237] [247] [248] [265] [267] [285] [301] [303] [307] [312] [314] [315] [318] [346] [347] [348] [349] [350] [352] [353] [354] [355] [364] ::=
shelf reference [445], indexer [451]?
| NEW, new shelf item reference [446]
| NEW, "?", guarded new shelf item reference [447]

[445] shelf reference [155] [158] [159] [214] [249] [346] [349] [353] [404] [444] [446] [447] [455] ::=
shelf name [449]
| shelf literal [442]
| record field reference [138]
| value function call [394]
| ELEMENTS, ancestry qualifier [38]
| CURRENT, ELEMENTS, ancestry qualifier [38]?

When value function call [394] is used as a shelf reference [445], the function definition must have specified a shelf class [386].

When CURRENT ELEMENTS specifies an ancestry qualifier [38], the latter must not end with markup event primary [346].

[446] new shelf item reference [169] [444] ::= shelf reference [445], key indexer [453]?, ((AFTER | BEFORE), indexer [451])?

[447] guarded new shelf item reference [169] [444] ::= shelf reference [445], key indexer [453]

[448] shelf alias [198] [206] [209] [214] [439] ::= name [464]

[449] shelf name [433] [436] [445] ::=
name [464]
| built-in shelf name [450]

[450] built-in shelf name [449] ::=
built-in read-only dtd shelf name [35]
| built-in read-only numeric shelf name [259]
| built-in read-only markup-event shelf name [37]
| built-in read-only stream shelf name [295]
| built-in read-write stream shelf name [296]
| built-in write-only stream shelf name [294]
| built-in read-only switch shelf name [325]

[451] indexer [66] [67] [197] [266] [444] [446] ::=
item indexer [452]
| key indexer [453]
| lastmost indexer [454]

[452] item indexer [66] [267] [451] [455] ::= "[", numeric expression [238], "]"

[453] key indexer [226] [228] [248] [446] [447] [451] ::= "{", string expression [260], "}"

[454] lastmost indexer [451] ::= LASTMOST

17.3 Shelf Tests

[455] shelf test primary [318] ::=
shelf reference [445], item indexer [452]?, (IS | ISNT), KEYED
| shelf reference [445], (HAS | HASNT), KEY, string primary [265]
| REFERENTS, (HAS | HASNT), KEY, string primary [265]


18 Macros

[456] macro definition [111] ::= MACRO, macro name [457], parameter template [458]*, IS, replacement template item [463]*, MACRO-END

[457] macro name [456] ::= macro token [460]+

[458] parameter template [456] ::=
ARG, macro parameter [459], macro token [460]+
| TOKEN, macro parameter [459], macro token [460]*

[459] macro parameter [458] [460] [463] ::=
delimiter token [461]
| name [464]

[460] macro token [457] [458] ::= LITERAL?, macro parameter [459]

[461] delimiter token [459] [463] ::=
infix function name [467]
| delimiter character [462]

[462] delimiter character [461] ::= "(" | ")" | "{" | "}" | "[" | "]" | "`" | ":" | "."

[463] replacement template item [456] ::=
macro parameter [459]
| LITERAL?, string literal [269]
| LITERAL?, delimiter token [461]
| LITERAL?, name [464]
| LITERAL?, number [250]


19 Lexeme Productions

[464] name [34] [51] [94] [98] [99] [100] [101] [102] [138] [139] [309] [333] [376] [378] [384] [385] [387] [388] [391] [407] [413] [414] [415] [416] [417] [419] [420] [448] [449] [459] [463] [467] [468] ::= letter [465], (digit [466] | letter [465] | user-defined name character [478] | "." | "-" | "_")* | "#", constant string literal [278]

[465] letter [464] ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"

[466] digit [251] [464] ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

[467] infix function name [376] [461] [472] ::= infix function start character [469], function following character [471]* | name [464]

[468] prefix function name [375] [394] [395] ::= prefix function start character [470], function following character [471]* | name [464]

[469] infix function start character [467] ::= function following character [471] | prefix function start character [470]

[470] prefix function start character [468] [469] ::= "!" | "-" | "+" | "%" | "?" | "/" | "~" | "$" | "\" | "@" | "^" | ","

[471] function following character [467] [468] [469] ::= "*" | "=" | "|" | "<" | ">" | "&"


20 Dynamically-Defined Lexical Tokens

[472] user-defined infix function name [141] [236] [246] ::= Any infix function name [467] defined in a program rather than by OmniMark, and which are not overloadings of operators defined by OmniMark to be overloadable.

[473] escape [282] [283] [284] [301] [302] [303] [304] [305] [306] [307] [308] [309] [310] [311] [312] [313] [314] [315] [474] ::= The escape [473] character is defined by an escape declaration [106]. If there is no escape declaration [106], the escape character is "%".

[474] unescaped character [271] [272] [280] [281] ::= An unescaped character [474] is any character that is not a "'", a """, a control character, or escape [473].

[475] describing number [284] ::= A describing number [475] is a number in the base indicated by the number [250] non-terminal in the described substring [284] production. The base can range from two to 36; the digits in each describing number [475] must be of the appropriate base, using letters (upper- or lower-case) for digit values over nine.

[476] system-specific function name [131] [392] [401] ::= A system-specific function name [476] is implemented as a constant string expression [273].

[477] system-specific library name [131] [392] [401] ::= A system-specific library name [477] is implemented as a constant string expression [273].

[478] user-defined name character [464] ::= A user-defined name character [478] is any character that appears in a LETTERS declaration that is not explicitly excluded from being a name character.

[479] user-defined data character ::= A user-defined data character [479] is any character that appears in a DATA-LETTERS declaration that is not explicitly excluded from being a name character.

Copyright © Stilo Corporation, 2003-2014. All rights reserved.
ETR62, 2014/6/9