Grammar for OmniMark 10.1

Table of Contents

Index of Productions

Notices

1 Program

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

[2] program [1] ::= program type [98]?, program-level declaration [106]?, preamble declaration [112]*, group member [93]*, identified group [91]*


2 Main Process Rules

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

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

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

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


3 Markup Processing Rules

[7] markup processing rule [94] ::=
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 [323]?, local scope [147]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[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] [40] [44] ::=
markup name [34]
| "~", string primary [268]

A "~" heralds a dynamic element name, where the string primary [268] 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] [51] [74] [75] [89] ::=
constant string literal [281]
| name [471]

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

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

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

3.2 Elements

[38] ancestry qualifier [32] [45] [69] [71] [192] [247] [268] [452] ::= 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 [355]
| CURRENT, ELEMENT, element name [32]

[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 [325] ::=
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, element name [32]

[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 [471]
| #EMPTY
| #NONE

3.3 Entity and Notation Tests

[52] entity test primary [325] ::=
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 [327], 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] [89] [90] ::=
#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] [69] [70] [71] [72] [268] ::=
complex qualified attribute identifier [70]
| simple qualified attribute identifier [69], item indexer [459]?

[67] qualified attribute identifier [81] [192] [214] [249] [270] ::=
complex qualified attribute identifier [70]
| simple qualified attribute identifier [69]

[68] qualified attribute set identifier [82] [214] [249] ::=
complex qualified attribute set identifier [72]
| simple qualified attribute set identifier [71]

[69] simple qualified attribute identifier [66] [67] [192] ::=
ATTRIBUTE, attribute name [75], ancestry qualifier [38]?
| DATA-ATTRIBUTE, attribute name [75], (OF, "(", qualified attribute part identifier [66], ")")?
| CREATE-SPECIFIED-ATTRIBUTE, attribute declaration primary [360], FROM, string primary [268]
| CREATE-UNSPECIFIED-ATTRIBUTE, attribute declaration primary [360]

[70] complex qualified attribute identifier [66] [67] ::=
simple qualified attribute set identifier [71], indexer [458]
| DATA-ATTRIBUTE, attribute name [75], OF, qualified attribute part identifier [66]

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

[72] complex qualified attribute set identifier [68] ::= attribute subset specifier [73]?, DATA-ATTRIBUTES, OF, qualified attribute part identifier [66]

[73] attribute subset specifier [71] [72] ::=
NON-IMPLIED
| SPECIFIED

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

[75] attribute name [69] [70] [192] [309] ::= markup name [34]

[76] attribute type set [81] ::=
attribute type [77]
| "(", attribute type [77], ((AND | "&"), attribute type [77])*, ")"
| "(", attribute type [77], ((OR | "|"), attribute type [77])*, ")"

[77] attribute type [76] ::=
attribute declaration type [79]
| attribute default type [80]
| attribute specification type [78]

[78] attribute specification type [77] ::=
DEFAULTED
| IMPLIED
| SPECIFIED

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

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

3.4.1 Attribute Tests

[81] attribute test primary [325] ::= qualified attribute identifier [67], (IS | ISNT), attribute type set [76]

[82] attributes test primary [325] ::= qualified attribute set identifier [68], (HAS | HASNT), KEY, string primary [268]


4 Input Processing Rules

[83] input processing rule [94] ::=
find rule [85]
| find end rule [84]
| find start rule [86]
| external text entity rule [88]

[84] find end rule [83] ::= FIND-END, condition [323]?, local scope [147]

[85] find rule [83] ::= FIND, NULL?, pattern expression [335], condition [323]?, local scope [147]

[86] find start rule [83] ::= FIND-START, condition [323]?, local scope [147]

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

[88] external text entity rule [83] ::= EXTERNAL-TEXT-ENTITY, (extended entity name set [87] | implied entity type set [90]), condition [323]?, local scope [147]

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

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


5 Groups

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

[92] group identification [91] ::=
group name set [95]
| #IMPLIED

[93] group member [2] [91] ::=
common declaration [113]
| include [99]
| rule [94]

[94] rule [93] ::=
markup processing rule [7]
| input processing rule [83]
| line breaking rule [125]
| main process rule [3]
| markup error rule [19]

[95] group name set [92] [97] [170] ::= group name [96], ((AND | "&"), group name [96])*

[96] group name [95] ::=
constant string literal [281]
| name [471]

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


6 Aided-translation Types

[98] 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

[99] include [93] ::= INCLUDE, constant string literal [281]

[100] include guard declaration [113] ::= INCLUDE-GUARD, (constant string literal [281] | name [471])

7.2 Modules

[101] module declaration [1] ::=
MODULE, (SHARED, AS, (constant string literal [281] | name [471]))?
| MODULE, INTERFACE, SHARED, AS, (constant string literal [281] | name [471])
| MODULE, IMPLEMENTS, constant string literal [281]

[102] import declaration [113] ::=
IMPORT, constant string literal [281], EXPORT?, PREFIXED, BY, name [471], use clause [103]*, supply clause [104]*
| IMPORT, constant string literal [281], EXPORT?, UNPREFIXED, use clause [103]*, supply clause [104]*
| IMPORT, constant string literal [281], ONLY, use clause [103]+, supply clause [104]*

[103] use clause [102] ::=
EXPORT?, USE, name [471], (AS, name [471])?
| EXPORT?, USE, #CONVERSION-FUNCTIONS

[104] supply clause [102] ::= SUPPLY, name [471], (AS, name [471])?

7.3 Accessing Text Files

[105] library declaration [113] ::= LIBRARY, (constant string expression [276], constant string expression [276])+


8 Declarations

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

[107] default io declaration [106] ::= DECLARE, NO-DEFAULT-IO

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

[108] escape declaration [106] [480] ::= ESCAPE, constant string primary [279]

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

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

[110] main mode declaration [106] [111] ::= DECLARE, (#MAIN-INPUT | #MAIN-OUTPUT | #PROCESS-INPUT | #PROCESS-OUTPUT), HAS, (BINARY-MODE | TEXT-MODE)

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

[111] main output referent declaration [106] ::= DECLARE, #MAIN-OUTPUT, HAS, modifier literal for referents [438]

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

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

[112] preamble declaration [2] ::=
common declaration [113]
| global object definition [114]
| naming declaration [117]

[113] common declaration [93] [112] ::=
binary input declaration [115]
| binary output declaration [116]
| break-width declaration [124]
| delimiter declaration [306]
| import declaration [102]
| include guard declaration [100]
| library declaration [105]
| macro definition [463]
| symbol declaration [305]

[114] global object definition [112] ::=
catch definition [413]
| function definition [375]
| global shelf definition [440]
| require function definition [387]
| require shelf definition [441]
| user-defined type declaration [131]

[115] binary input declaration [113] ::= BINARY-INPUT, constant numeric expression [251]

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

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

[116] binary output declaration [113] ::= BINARY-OUTPUT, constant numeric expression [251]

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

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

8.1 Naming Declarations

[117] naming declaration [112] ::=
data letters declaration [118]
| entity namecase declaration [119]
| general namecase declaration [120]
| markup identification declaration [121]
| name letters declaration [122]
| newline declaration [123]

[118] data letters declaration [117] ::=
DECLARE, DATA-LETTERS, constant string expression [276], constant string expression [276]?
| LETTERS, constant string expression [276], constant string expression [276]?

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

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

entity namecase declaration [119] is deprecated.

[120] general namecase declaration [117] ::= NAMECASE, GENERAL, (YES | NO)

general namecase declaration [120] is deprecated.

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

[122] name letters declaration [117] ::= DECLARE, NAME-LETTERS, constant string expression [276], constant string expression [276]

[123] newline declaration [117] ::= NEWLINE, constant string expression [276]

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

8.2 Line-breaking Declarations

[124] break-width declaration [113] ::= BREAK-WIDTH, constant numeric expression [251], (number [250] | TO, constant numeric expression [251])?

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

[125] line breaking rule [94] ::=
insertion break rule [126]
| replacement break rule [127]

[126] insertion break rule [125] ::= INSERTION-BREAK, constant string expression [276], condition [323]?

[127] replacement break rule [125] ::= REPLACEMENT-BREAK, constant string primary [279], constant string expression [276], condition [323]?


9 Types

[128] type [376] [377] [378] [379] [380] [381] [384] [387] [392] [397] ::=
first-class type [129]
| qualified type [130]

[129] first-class type [128] [393] [395] [396] [441] [447] [450] ::=
user-defined type name [140]
| 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.

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

9.1 User-Defined Types

[131] user-defined type declaration [114] ::=
opaque type declaration [132]
| record type declaration [134]
| user-defined type require [138]

[132] opaque type declaration [131] ::= (DECLARE | EXPORT), (ABSTRACT, OPAQUE, user-defined type name [140] | OPAQUE, user-defined type name [140], opaque type declaration binding [133])

[133] opaque type declaration binding [132] ::= CREATED, BY, system-specific function name [483], (IN, FUNCTION-LIBRARY, system-specific library name [484])?

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

[135] record type declaration binding [134] ::=
field declaration [137]*
| ELSEWHERE

A record type declaration binding [135] 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.

[136] record type inheritance clause [134] ::= EXTENDS, user-defined type name [140]

user-defined type name [140] cannot be that of a restricted type.

[137] field declaration [135] ::= FIELD, shelf declaration [447]

[138] user-defined type require [131] ::= REQUIRE, OPAQUE, user-defined type name [140]

[139] record field reference [198] [214] [452] ::= user-defined type instance [144], ":", name [471]

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

[140] user-defined type name [129] [132] [134] [136] [138] [143] [206] [411] ::= name [471]

[141] user-defined type expression [144] [353] ::= expression [230]

[142] user-defined type subexpression [145] ::=
argument primary [408], (user-defined infix function name [479], argument primary [408])+
| user-defined type primary [143]

[143] user-defined type primary [142] ::=
user-defined type name [140], CAST, user-defined type primary [143]
| value function call [402]
| user-defined type instance [144]

[144] user-defined type instance [139] [143] ::=
shelf item reference [451]
| "(", user-defined type expression [141], ")"

[145] user-defined type test primary [325] ::= user-defined type subexpression [142], (reference comparer [146], user-defined type subexpression [142])+

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


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] [84] [85] [86] [88] [199] [200] [202] [203] [206] [207] [208] [213] [216] [217] [219] [220] [334] [401] ::= local declaration [443]*, action [150]*, catch alternative [149]*, always block [148]*

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

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

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

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

[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 [403]
| 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 [409]
| 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 [451], ((AND | "&"), shelf item reference [451])*

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 [453], ((AND | "&"), new shelf item reference [453])*
| NEW, "?", guarded new shelf item reference [454], ((AND | "&"), guarded new shelf item reference [454])*

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

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

[172] open action [152] ::= OPEN, shelf item reference [451], modifier expression [431]?, AS, string sink literal for open [373], modifier expression [431]?

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

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

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

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

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

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

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

A modifier expression [431] 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 [431] on the left-hand side is restricted to using the modifiers defined by modifier literal for reopen [436].

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

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

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

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

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

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

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

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

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

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

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

[189] throw action [152] ::= (SIGNAL, (TO, shelf item reference [451])?)?, (THROW, throw invocation [429] | 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 [75])?

The alias, attribute name [75], 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 [97]
| USING, GROUP, "(", current group set [97], ")"

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

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

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

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

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

If shelf item reference [451] contains a shelf literal [450] or a record field reference [139], the shelf alias [455] is required.


12 Block Constructs

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

[200] do conditional action [152] ::= DO, condition [323], local scope [147], (ELSE, condition [323], 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 [369], 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 [251], (TO, constant numeric expression [251])?

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

[207] do skip action [152] ::= DO, SKIP, (OVER, pattern expression [335] | PAST, numeric expression [238], (OVER, pattern expression [335])?), 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 [455]

[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] [334] ::= 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 [74])?
| qualified attribute set identifier [68], AS, attribute alias [74]
| REVERSED?, shelf reference [452], (AS, shelf alias [455])?
| REFERENTS

If shelf reference [452] is a shelf literal [450], a record field reference [139], or a reference to CURRENT ELEMENTS, the shelf alias [455] is required.

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

[216] match alternative [202] [215] ::= MATCH, UNANCHORED?, NULL?, pattern expression [335], condition [323]?, 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 [367], 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 [324]

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

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

[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 [460]

[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 [460]

12.1.1 Markup Parse Support

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

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 [403] must be to a void-valued function.


13 Expressions

[230] expression [141] [154] [180] [181] [190] [237] [238] [263] [324] [354] [356] [357] [358] [359] [361] [362] [364] [367] [369] [371] [392] [407] [450] ::= 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 [328], subexpression [235])+ | inequality comparer [329], subexpression [235])?

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

[236] expression secondary [235] [267] ::= expression primary [237], (user-defined infix function name [479], argument primary [408])+

[237] expression primary [236] [408] ::=
ancestry expression [39]
| attribute declaration primary [360]
| attribute default declaration primary [361]
| attribute value declaration primary [362]
| boolean primary [325]
| content model primary [359]
| dtd primary [356]
| element declaration primary [358]
| entity declaration primary [357]
| markup event primary [355]
| markup sink primary [365]
| markup source primary [368]
| numeric primary [247]
| string primary [268]
| string sink primary [372]
| string source primary [370]
| shelf item reference [451]
| value function call [402]
| "(", expression [230], ")"

13.1 Numeric Expressions

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

[239] numeric subexpression [258] [259] [260] [261] [265] [266] [437] [439] ::= subexpression [235]

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

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

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

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

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

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

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

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

[248] item-of reference [247] ::=
shelf item reference [451]
| simple qualified attribute set identifier [71], key indexer [460]
| REFERENTS, key indexer [460]
| THIS, REFERENT

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

[250] number [124] [247] [255] [286] [287] [308] [309] [310] [313] [314] [318] [319] [321] [322] [439] [470] [482] ::= digit [473]+

13.1.1 Constant Numeric Expressions

[251] constant numeric expression [115] [116] [124] [205] [255] [278] [448] [449] ::= constant numeric term [252], (numeric additive operator [240], constant numeric term [252])*

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

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

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

[255] constant numeric primary [254] [277] ::=
constant string primary [279]
| (NEGATE | "-"), constant numeric primary [255]
| COMPLEMENT, constant numeric primary [255]
| BINARY, constant string primary [279]
| LENGTH, OF, constant string primary [279]
| number [250]
| "(", constant numeric expression [251], ")"

13.1.2 Numeric Tests

[256] numeric test primary [325] ::= VALUE?, full numeric test [257]

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

[257] full numeric test [256] ::=
ascending numeric comparison [258]
| descending numeric comparison [259]
| equality numeric comparison [260]
| inequality numeric comparison [261]

[258] ascending numeric comparison [257] ::= numeric subexpression [239], (equality comparer [328], numeric subexpression [239])*, strongly ascending comparer [332], numeric subexpression [239], (weakly ascending comparer [330], numeric subexpression [239])*

[259] descending numeric comparison [257] ::= numeric subexpression [239], (equality comparer [328], numeric subexpression [239])*, strongly descending comparer [333], numeric subexpression [239], (weakly descending comparer [331], numeric subexpression [239])*

[260] equality numeric comparison [257] ::= numeric subexpression [239], (equality comparer [328], numeric subexpression [239])+

[261] inequality numeric comparison [257] ::= numeric subexpression [239], inequality comparer [329], numeric subexpression [239]

13.1.3 Built-In Numeric Shelves

[262] built-in read-only numeric shelf name [457] ::=
#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

[263] string expression [168] [171] [175] [182] [183] [184] [188] [194] [215] [223] [268] [297] [438] [460] ::= expression [230]

[264] string subexpression [292] [293] [294] [295] [296] [297] ::= subexpression [235]

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

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

[266] string factor [265] ::= string secondary [267], ((FORMAT | "%"), numeric subexpression [239])*

[267] string secondary [244] [266] ::=
expression secondary [236]
| string primary [268]

[268] string primary [32] [69] [82] [237] [247] [267] [269] [298] [340] [355] [358] [361] [374] [462] ::=
stream input/output mode [271]?, value function call [402]
| constant string value [280]
| external function association enquiry [410]
| pattern name [342]
| qualified attribute part identifier [66]
| referent item reference [269]
| shelf item reference [451]
| stream input/output mode [271]?, FILE, string primary [268]
| DATE, string primary [268]
| KEY, OF, key-of reference [270]
| NAME, OF, shelf item reference [451]
| NAME, OF, element declaration primary [358]
| NAME, ancestry qualifier [38]
| XMLNS-NAME, ancestry qualifier [38]
| "~", string primary [268]
| string literal [272]
| "(", string expression [263], ")"

[269] referent item reference [268] [374] ::=
REFERENTS, indexer [458]
| THIS, REFERENT
| REFERENT, string primary [268]
| SILENT-REFERENT, string primary [268]

[270] key-of reference [268] ::=
qualified attribute identifier [67]
| shelf item reference [451]
| REFERENTS, item indexer [459]
| THIS, REFERENT

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

13.2.1 String Literals

[272] string literal [268] [340] [470] ::= string literal part [273], ("_", string literal part [273])*

[273] string literal part [272] ::=
double-quoted string literal part [274]
| single-quoted string literal part [275]

[274] double-quoted string literal part [273] ::= """, (described character [286] | described substring [287] | escaped text [285] | format item [307] | unescaped character [481] | "'")*, """

[275] single-quoted string literal part [273] ::= "'", (described character [286] | described substring [287] | escaped text [285] | format item [307] | unescaped character [481] | """)*, "'"

13.2.2 Constant String Expressions

[276] constant string expression [105] [118] [122] [123] [126] [127] [279] [305] [306] [483] [484] ::= constant string term [277], ((JOIN | "||"), constant string term [277])*

[277] constant string term [276] ::= constant string factor [278], ((REPEATED | "||*"), constant numeric primary [255])?

[278] constant string factor [277] ::= constant string primary [279], ((FORMAT | "%"), (constant numeric expression [251] | constant string primary [279]))*

[279] constant string primary [108] [127] [254] [255] [278] [280] ::=
constant string value [280]
| constant string literal [281]
| "(", constant string expression [276], ")"

[280] constant string value [268] [279] ::= COMPILED-DATE, constant string primary [279]

[281] constant string literal [34] [96] [99] [100] [101] [102] [279] [350] [437] [471] ::= constant string literal part [282], ("_", constant string literal part [282])*

[282] constant string literal part [281] ::=
double-quoted constant string literal part [283]
| single-quoted constant string literal part [284]

[283] double-quoted constant string literal part [282] ::= """, (described character [286] | described substring [287] | escaped text [285] | unescaped character [481] | "'")*, """

[284] single-quoted constant string literal part [282] ::= "'", (described character [286] | described substring [287] | escaped text [285] | unescaped character [481] | """)*, "'"

[285] escaped text [274] [275] [283] [284] ::= escape [480], (escape [480] | """ | "'" | "#" | ")")

[286] described character [274] [275] [283] [284] ::=
escape [480], "_"
| escape [480], "n"
| escape [480], "t"
| escape [480], number [250], "#"

[287] described substring [274] [275] [283] [284] [482] ::= escape [480], number [250], "r", "{", describing number [482], (",", describing number [482])*, "}"

13.2.3 Stream Tests

[288] stream test primary [325] ::=
shelf item reference [451], (HAS | HASNT), NAME
| shelf item reference [451], (IS | ISNT), stream type set [289]

[289] stream type set [288] ::=
stream type [290]
| "(", stream type [290], ((AND | "&"), stream type [290])*, ")"
| "(", stream type [290], ((OR | "|"), stream type [290])*, ")"

[290] stream type [289] ::=
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

[291] string test primary [325] ::=
ascending string comparison [292]
| descending string comparison [293]
| equality string comparison [294]
| inequality string comparison [295]
| string match test primary [296]
| string set test primary [297]

[292] ascending string comparison [291] ::= string subexpression [264], (equality comparer [328], string subexpression [264])*, strongly ascending comparer [332], string subexpression [264], (weakly ascending comparer [330], string subexpression [264])*

[293] descending string comparison [291] ::= string subexpression [264], (equality comparer [328], string subexpression [264])*, strongly descending comparer [333], string subexpression [264], (weakly descending comparer [331], string subexpression [264])*

[294] equality string comparison [291] ::= string subexpression [264], (equality comparer [328], string subexpression [264])+

[295] inequality string comparison [291] ::= string subexpression [264], inequality comparer [329], string subexpression [264]

[296] string match test primary [291] ::= string subexpression [264], MATCHES, UNANCHORED?, pattern secondary [339]

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

[297] string set test primary [291] ::=
string subexpression [264], comparer [326], UL, string subexpression [264]
| string subexpression [264], comparer [326], UL?, "(", string expression [263], ((OR | "|"), string expression [263])*, ")"

13.2.5 Source Tests

[298] source test primary [325] ::=
FILE, string primary [268], EXISTS
| FILE, string primary [268], (IS | ISNT), file info enquiry set [299]
| #CURRENT-INPUT, (IS | ISNT), ATTACHED

[299] file info enquiry set [298] ::=
file info enquiry [300]
| "(", file info enquiry [300], ((AND | "&"), file info enquiry [300])*, ")"

[300] file info enquiry [299] ::=
DIRECTORY
| FILE
| READABLE
| WRITABLE

13.2.6 Built-In Stream Shelves

[301] built-in write-only stream shelf name [457] ::=
#CONSOLE
| #CURRENT-OUTPUT
| #ERROR
| #LOG
| #MAIN-OUTPUT
| #MARKUP-PARSER
| #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.

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

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

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

13.2.7 Formatting Declarations

[305] symbol declaration [113] ::= SYMBOL, constant string expression [276]+

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

[306] delimiter declaration [113] ::= DELIMITER, constant string expression [276]

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

13.2.8 Format Items

[307] format item [274] [275] ::=
alphabetic format item [308]
| attribute format item [309]
| binary format item [310]
| break format item [311]
| content format item [312]
| current name format item [313]
| decimal format item [314]
| end break suppress format item [315]
| macro format item [316]
| other format item [317]
| pattern format item [318]
| roman format item [319]
| start break suppress format item [320]
| stream format item [321]
| symbol format item [322]

[308] alphabetic format item [307] ::= escape [480], (number [250], "f" | "j" | "k" | "l" | "u" | "w")*, "a", "(", shelf item reference [451], ")"

[309] attribute format item [307] ::= escape [480], (number [250], "f" | "k" | "e" | "h" | "l" | "o" | "p" | "s" | "u" | "z")*, "v", "(", attribute name [75], ")"

[310] binary format item [307] ::= escape [480], (number [250], "f" | number [250])*, "b", "(", shelf item reference [451], ")"

[311] break format item [307] ::= escape [480], "/"

[312] content format item [307] ::= escape [480], ("h" | "l" | "s" | "u" | "z")*, "c"

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

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

[315] end break suppress format item [307] ::= escape [480], "]"

[316] macro format item [307] ::= escape [480], ("u" | "l")?, "@", (escape [480] | "(", name [471], ")")

[317] other format item [307] ::=
escape [480], "s", "_"
| escape [480], "s", "n"
| escape [480], "s", "t"
| escape [480], "e", "n"

[318] pattern format item [307] ::= escape [480], (number [250], "f" | "k" | "h" | "l" | "s" | "u")*, "x", "(", pattern name [342], ")"

pattern format item [318] is deprecated in favour of stream format item [321].

[319] roman format item [307] ::= escape [480], (number [250], "f" | "k" | "l" | "u")*, "i", "(", shelf item reference [451], ")"

[320] start break suppress format item [307] ::= escape [480], "["

[321] stream format item [307] [318] ::= escape [480], (number [250], "f" | "k" | "l" | "u" | "e")*, "g", "(", (shelf item reference [451] | pattern name [342]), ")"

[322] symbol format item [307] ::= escape [480], (number [250], "f" | "k")*, "y", "(", shelf item reference [451], ")"

13.3 Boolean Expressions

[323] condition [4] [5] [6] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [84] [85] [86] [88] [126] [127] [151] [200] [216] [340] ::= (WHEN | UNLESS), boolean expression [324]

[324] boolean expression [154] [222] [224] [323] [325] ::= expression [230]

[325] boolean primary [237] [340] [360] ::=
shelf item reference [451]
| value function call [402]
| FALSE
| TRUE
| "~", boolean primary [325]
| argument test primary [412]
| attribute test primary [81]
| attributes test primary [82]
| catch test primary [430]
| element test primary [42]
| entity test primary [52]
| numeric test primary [256]
| pattern test primary [352]
| shelf test primary [462]
| source test primary [298]
| stream test primary [288]
| string test primary [291]
| user-defined type test primary [145]
| ACTIVE, boolean primary [325]
| "(", boolean expression [324], ")"

Use of the ACTIVE keyword is unnecessary and is deprecated.

[326] comparer [297] ::=
equivalence comparer [327]
| strongly ascending comparer [332]
| strongly descending comparer [333]

[327] equivalence comparer [52] [326] ::=
equality comparer [328]
| inequality comparer [329]

[328] equality comparer [234] [258] [259] [260] [292] [293] [294] [327] [330] [331] ::=
IS, EQUAL
| "="

[329] inequality comparer [234] [261] [295] [327] ::=
ISNT, EQUAL
| "!", "="

[330] weakly ascending comparer [258] [292] ::=
equality comparer [328]
| strongly ascending comparer [332]

[331] weakly descending comparer [259] [293] ::=
equality comparer [328]
| strongly descending comparer [333]

[332] strongly ascending comparer [258] [292] [326] [330] ::=
IS, LESS-EQUAL
| ISNT, GREATER-THAN
| "<="
| IS, LESS-THAN
| ISNT, GREATER-EQUAL
| "<"

[333] strongly descending comparer [259] [293] [326] [331] ::=
IS, GREATER-EQUAL
| ISNT, LESS-THAN
| ">="
| IS, GREATER-THAN
| ISNT, LESS-EQUAL
| ">"

13.3.1 Built-In Switch Shelves

[334] built-in read-only switch shelf name [457] ::=
#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

[335] pattern expression [24] [26] [85] [207] [216] [340] ::= pattern product [336], ((OR | "|"), pattern product [336])*

[336] pattern product [335] ::=
pattern factor [337], pattern product [336]?
| pattern prefix modifier [341]*, pattern product [336]
| (character set [347] | character class name [346]), ("**" | "++"), ("=>", pattern name [342])?, pattern product [336]

[337] pattern factor [336] ::=
(pattern entity type [343] | pattern nonentity type [344])?, pattern tertiary [338]
| pattern entity type [343], NAMED, pattern tertiary [338], (VALUED, pattern tertiary [338])?
| pattern entity type [343], VALUED, pattern tertiary [338], (NAMED, pattern tertiary [338])?
| pattern nonentity type [344], VALUED, pattern tertiary [338]

[338] pattern tertiary [337] ::= pattern prefix modifier [341]*, pattern secondary [339], ("=>", pattern name [342])?

[339] pattern secondary [265] [296] [338] ::= pattern primary [340], occurrence indicator [345]?

[340] pattern primary [339] ::=
character class name [346]
| character set [347]
| string literal [272]
| positional pattern [351]
| ANOTHER?, pattern name [342]
| value function call [402]
| "~", string primary [268]
| "~", boolean primary [325]
| "(", condition [323], ")"
| "(", pattern expression [335], condition [323]?, ")"

[341] pattern prefix modifier [336] [338] ::=
LOOKAHEAD
| LOOKAHEAD, NOT
| UL

[342] pattern name [268] [318] [321] [336] [338] [340] [352] ::= name [471]

[343] pattern entity type [337] ::=
CDATA
| SDATA
| ENTITY

[344] pattern nonentity type [337] ::=
PCDATA
| NON-CDATA
| NON-SDATA
| TEXT

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

[346] character class name [336] [340] [350] ::=
ANY
| ANY-TEXT
| BLANK
| DIGIT
| LC
| LETTER
| SPACE
| UC
| WHITE-SPACE

[347] character set [336] [340] ::=
"[", character set term [349], (character set exception operator [348], character set term [349])?, "]"
| "[", character set exception operator [348], character set term [349], "]"

[348] character set exception operator [347] ::=
"\"
| EXCEPT

[349] character set term [347] ::= character set product [350], ((OR | "|"), character set product [350])*

[350] character set product [349] ::=
character class name [346]
| constant string literal [281], (TO, constant string literal [281])?

[351] positional pattern [340] ::=
CONTENT-END
| CONTENT-START
| LINE-END
| LINE-START
| VALUE-END
| VALUE-START
| WORD-END
| WORD-START

13.4.1 Pattern Tests

[352] pattern test primary [325] ::= pattern name [342], (IS | ISNT), SPECIFIED

[353] hierarchical type expression [206] ::=
markup event expression [354]
| user-defined type expression [141]

13.5 Markup Events

[354] markup event expression [353] [355] ::= expression [230]

[355] markup event primary [40] [237] [358] [429] [452] ::=
built-in read-only markup-event shelf name [37]
| CREATE-ELEMENT-EVENT, element declaration primary [358], (ATTRIBUTES, shelf reference [452])?
| CREATE-PROCESSING-INSTRUCTION-EVENT, string primary [268]
| shelf item reference [451]
| value function call [402]
| "(", markup event expression [354], ")"

13.6 Markup Declarations

[356] dtd primary [237] [357] [358] ::=
built-in read-only dtd shelf name [35]
| shelf item reference [451]
| value function call [402]
| "(", expression [230], ")"

[357] entity declaration primary [237] ::=
DECLARED-GENERAL-ENTITIES, OF, dtd primary [356]
| DECLARED-PARAMETER-ENTITIES, OF, dtd primary [356]
| shelf item reference [451]
| value function call [402]
| "(", expression [230], ")"

[358] element declaration primary [237] [268] [355] [359] [360] [362] ::=
CREATE-ELEMENT-DECLARATION, string primary [268], ATTRIBUTES, shelf reference [452], CONTENT, content model primary [359]
| DECLARATION, OF, markup event primary [355]
| DECLARED-ELEMENTS, OF, dtd primary [356]
| shelf item reference [451]
| value function call [402]
| "(", expression [230], ")"

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

[360] attribute declaration primary [69] [237] ::= (CREATE-ATTRIBUTE-DECLARATION, attribute value declaration primary [362], DEFAULT, attribute default declaration primary [361], (CASE-SENSITIVE, boolean primary [325])? | ATTRIBUTES, OF, element declaration primary [358])

[361] attribute default declaration primary [237] [360] ::= (ATTRIBUTE-DECLARED-CURRENT | ATTRIBUTE-DECLARED-CONREF | ATTRIBUTE-DECLARED-DEFAULTED, TO, string primary [268] | ATTRIBUTE-DECLARED-FIXED, TO, string primary [268] | ATTRIBUTE-DECLARED-IMPLIED | ATTRIBUTE-DECLARED-REQUIRED | shelf item reference [451] | value function call [402] | "(", expression [230], ")")

[362] attribute value declaration primary [237] [360] ::= (ATTRIBUTE-DECLARED-CDATA | ATTRIBUTE-DECLARED-ENTITY | ATTRIBUTE-DECLARED-ENTITIES | ATTRIBUTE-DECLARED-GROUP, shelf reference [452] | 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 [358] | shelf item reference [451] | value function call [402] | "(", expression [230], ")")

13.7 Stream Expressions

[363] stream expression ::= shelf item reference [451]

13.8 Markup Sink Expressions

[364] markup sink expression [365] ::= expression [230]

[365] markup sink primary [237] ::=
built-in markup sink name [366]
| value function call [402]
| "(", markup sink expression [364], ")"

[366] built-in markup sink name [365] ::= #SUPPRESS

13.9 Markup Source Expressions

[367] markup source expression [219] [368] ::= expression [230]

[368] markup source primary [237] ::=
built-in markup source name [36]
| value function call [402]
| "(", markup source expression [367], ")"

13.10 String Source Expressions

[369] string source expression [173] [185] [202] [229] [370] ::= expression [230]

[370] string source primary [237] ::=
built-in string source name [304]
| value function call [402]
| "(", string source expression [369], ")"

13.11 String Sink Expressions

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

[372] string sink primary [181] [237] ::=
shelf item reference [451], modifier expression [431]?
| string sink literal [374], modifier expression [431]?

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

[373] string sink literal for open [172] [178] [374] ::=
string sink literal [374]
| BUFFER

[374] string sink literal [372] [373] ::=
FILE, string primary [268]
| REFERENT, string primary [268]
| THIS, REFERENT
| value function call [402]

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 [373], it is interpreted as a referent item reference [269], unless preceded by the FILE keyword.

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


14 Functions

14.1 Function Definition

[375] function definition [114] ::=
external prefix function definition [376]
| external infix function definition [377]
| external conversion function definition [378]
| internal prefix function definition [379]
| internal infix function definition [380]
| internal conversion function definition [381]

[376] external prefix function definition [375] [396] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, shelf class [394]?, type [128]?, prefix function signature definition [383], external function binding [400]

[377] external infix function definition [375] [396] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, type [128], infix function signature definition [384], external function binding [400]

[378] external conversion function definition [375] [396] ::= (DEFINE | EXPORT), EXTERNAL, type [128], conversion function signature definition [385], external function binding [400]

[379] internal prefix function definition [375] [396] ::= (DEFINE | EXPORT), function categorization kind [382]?, shelf class [394]?, type [128]?, prefix function signature definition [383], internal function binding [401]

[380] internal infix function definition [375] [396] ::= (DEFINE | EXPORT), OVERLOADED?, type [128], infix function signature definition [384], internal function binding [401]

[381] internal conversion function definition [375] [396] ::= (DEFINE | EXPORT), type [128], conversion function signature definition [385], internal function binding [401]

[382] function categorization kind [379] ::=
DYNAMIC?, OVERLOADED
| OVERRIDING

[383] prefix function signature definition [376] [379] ::= FUNCTION, prefix function name [475], function argument list definition [388]?

[384] infix function signature definition [377] [380] ::= INFIX-FUNCTION, VALUE, type [128], name [471], infix function name [474], VALUE, type [128], name [471]

[385] conversion function signature definition [378] [381] ::= CONVERSION-FUNCTION, function argument definition [391]

[386] function name [387] [411] ::= name [471]

[387] require function definition [114] ::= REQUIRE, type [128]?, FUNCTION, function name [386], function argument list definition [388]?

[388] function argument list definition [383] [387] ::=
parenthesized function argument list definition [389]
| unparenthesized function argument list definition [390]

[389] parenthesized function argument list definition [388] ::=
"(", ")"
| "(", function argument definition [391], (argument separator [398], function argument definition [391])*, (argument separator [398], remainder argument definition [395], (argument separator [398], ".", ".", ".")?, ")")?
| "(", remainder argument definition [395], argument separator [398], ".", ".", ".", ")"

[390] unparenthesized function argument list definition [388] ::=
argument herald [399]?, function argument definition [391], (argument herald [399], function argument definition [391])*, (argument herald [399], remainder argument definition [395], (argument herald [399], ".", ".", ".")?)?
| argument herald [399], remainder argument definition [395], (argument herald [399], ".", ".", ".")?
| remainder argument definition [395], argument herald [399], ".", ".", "."

[391] function argument definition [385] [389] [390] ::=
expression argument definition [392]
| shelf class argument definition [393]
| converting argument definition [396]

[392] expression argument definition [391] [419] ::= VALUE, type [128], name [471], (OPTIONAL, (INITIAL, "{", expression [230], "}")?)?

[393] shelf class argument definition [391] [419] ::= shelf class [394], first-class type [129], name [471], OPTIONAL?

[394] shelf class [376] [379] [393] [452] ::=
MODIFIABLE
| READ-ONLY
| WRITE-ONLY

[395] remainder argument definition [389] [390] ::= REMAINDER, first-class type [129], name [471]

[396] converting argument definition [391] ::=
VALUE, "(", ANY, INTO, first-class type [129], ")"
| VALUE, "(", source type name [397], ((OR | "|"), source type name [397])*, INTO, first-class type [129], ")"

A converting argument definition [396] is only allowed as the first argument of an OVERLOADED external prefix function definition [376] or internal prefix function definition [379], as an argument of an OVERLOADED external infix function definition [377] or internal infix function definition [380], or as the argument of an external conversion function definition [378] or internal conversion function definition [381].

[397] source type name [396] ::=
type [128]
| NUMERIC-LITERAL

[398] argument separator [389] [404] [417] [427] ::=
argument herald [399]
| ","

[399] argument herald [390] [398] [405] [406] [418] [428] ::= name [471]

[400] external function binding [376] [377] [378] ::= AS, system-specific function name [483], (IN, FUNCTION-LIBRARY, system-specific library name [484])?

[401] internal function binding [379] [380] [381] ::=
AS, local scope [147]
| ELSEWHERE

14.2 Function Invocation

[402] value function call [143] [237] [247] [268] [325] [340] [355] [356] [357] [358] [359] [361] [362] [365] [368] [370] [374] [452] ::=
prefix function name [475], parenthesized call arguments [404]
| prefix function name [475], unparenthesized call arguments [405]

[403] void function call [152] [229] ::=
prefix function name [475], parenthesized call arguments [404]
| prefix function name [475], void unparenthesized call arguments [406]

[404] parenthesized call arguments [402] [403] [429] ::= "(", (argument expression [407], (argument separator [398], argument expression [407])*)?, ")"

[405] unparenthesized call arguments [402] [429] ::= (argument herald [399]?, argument primary [408], (argument herald [399], argument primary [408])*)?

[406] void unparenthesized call arguments [403] ::= (argument herald [399]?, argument expression [407], (argument herald [399], argument expression [407])*)?

[407] argument expression [404] [406] ::= expression [230]

[408] argument primary [142] [236] [246] [405] ::= expression primary [237]

14.3 External Function Associations

[409] set external function association action [152] ::=
SET, external function identification [411], TO, system-specific function name [483]
| SET, FUNCTION-LIBRARY, OF, external function identification [411], TO, system-specific library name [484]

[410] external function association enquiry [268] ::= (FUNCTION-LIBRARY, OF)?, external function identification [411]

[411] external function identification [409] [410] ::=
(EXTERNAL-FUNCTION | EXTERNAL-OUTPUT-FUNCTION), function name [386]
| CREATOR, OF, user-defined type name [140]

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

14.4 Function Argument Tests

[412] argument test primary [325] ::= shelf item reference [451], (IS | ISNT), SPECIFIED


15 Catch and Throw

15.1 Catch Definitions

[413] catch definition [114] ::= (DECLARE | EXPORT | REQUIRE), catch signature [414]

[414] catch signature [413] ::= CATCH, catch name [415], catch argument list definition [416]?

[415] catch name [414] [426] [429] [430] ::= name [471]

[416] catch argument list definition [414] ::=
parenthesized catch argument list definition [417]
| unparenthesized catch argument list definition [418]

[417] parenthesized catch argument list definition [416] ::=
"(", ")"
| "(", catch argument definition [419], (argument separator [398], catch argument definition [419])*, ")"

[418] unparenthesized catch argument list definition [416] ::= argument herald [399]?, catch argument definition [419], (argument herald [399], catch argument definition [419])*

[419] catch argument definition [417] [418] ::=
expression argument definition [392]
| shelf class argument definition [393]

15.2 Throws

[420] built-in catch invocation [149] ::=
external-exception invocation [421]
| program-error invocation [422]
| markup-start invocation [423]
| markup-end invocation [424]
| markup-point invocation [425]

[421] external-exception invocation [420] ::= #EXTERNAL-EXCEPTION, (IDENTITY, name [471])?, (MESSAGE, name [471])?, (LOCATION, name [471])?

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

[422] program-error invocation [420] ::= #PROGRAM-ERROR, (CODE, name [471])?, (MESSAGE, name [471])?, (LOCATION, name [471])?

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

[423] markup-start invocation [420] ::= #MARKUP-START, name [471]

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

[424] markup-end invocation [420] ::= #MARKUP-END, name [471]

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

[425] markup-point invocation [420] ::= #MARKUP-POINT, name [471]

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

[426] catch invocation [149] ::=
catch name [415], parenthesized invocation arguments [427]
| catch name [415], unparenthesized invocation arguments [428]

[427] parenthesized invocation arguments [426] ::= "(", (name [471], (argument separator [398], name [471])*)?, ")"

[428] unparenthesized invocation arguments [426] ::= (argument herald [399]?, name [471], (argument herald [399], name [471])*)?

[429] throw invocation [189] ::=
catch name [415], parenthesized call arguments [404]
| catch name [415], unparenthesized call arguments [405]
| #MARKUP-START, markup event primary [355]
| #MARKUP-END, markup event primary [355]
| #MARKUP-POINT, markup event primary [355]

15.3 Catch Tests

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


16 Stream Modifiers

[431] modifier expression [172] [178] [181] [372] ::=
WITH, modifier literal [433], (WITH, modifier literal [433])*
| WITH, modifier subexpression [432]

[432] modifier subexpression [431] ::= "(", modifier literal [433], ((AND | "&"), modifier literal [433])*, ")"

[433] modifier literal [431] [432] ::= modifier literal for open [434]

[434] modifier literal for open [433] ::=
modifier literal for set [435]
| BINARY-MODE
| BUFFERED
| TEXT-MODE
| UNBUFFERED

[435] modifier literal for set [181] [434] ::=
modifier literal for reopen [436]
| APPEND

[436] modifier literal for reopen [178] [435] ::=
modifier literal for content [437]
| modifier literal for referents [438]
| modifier literal for break-width [439]

[437] modifier literal for content [372] [436] ::=
constant string literal [281]
| BINARY, numeric subexpression [239]
| DOMAIN-FREE

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

[438] modifier literal for referents [111] [436] ::=
REFERENTS-ALLOWED, (DEFAULTING, "{", string expression [263], (",", string expression [263])?, "}")?
| REFERENTS-DISPLAYED
| REFERENTS-NOT-ALLOWED

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


17 Shelves

17.1 Shelf Definitions

[440] global shelf definition [114] ::= EXPORT?, global shelf class [442], shelf declaration [447], ((AND | "&"), shelf declaration [447])*

[441] require shelf definition [114] ::= REQUIRE, global shelf class [442], first-class type [129], shelf name [456]

[442] global shelf class [440] [441] ::=
CONSTANT
| DOMAIN-BOUND?, GLOBAL

[443] local declaration [147] ::=
global shelf save declaration [444]
| groups save declaration [445]
| local shelf declaration [446]

[444] global shelf save declaration [443] ::= (SAVE | SAVE-CLEAR), shelf name [456], ((AND | "&"), shelf name [456])*

[445] groups save declaration [443] ::= SAVE, GROUPS

[446] local shelf declaration [443] ::= LOCAL, shelf declaration [447], ((AND | "&"), shelf declaration [447])*

[447] shelf declaration [137] [440] [446] [450] ::= first-class type [129], shelf alias [455], (fixed-size shelf declaration [449] | variable-size shelf declaration [448])?, (INITIAL, shelf literal [450])?

[448] variable-size shelf declaration [447] ::= VARIABLE, (TO, constant numeric expression [251])?, (INITIAL-SIZE, constant numeric expression [251])?

[449] fixed-size shelf declaration [447] ::= SIZE, constant numeric expression [251]

[450] shelf literal [198] [214] [447] [452] ::= "{", (expression [230] | UNATTACHED), "}"

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

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

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

17.2 Shelf References

[451] shelf item reference [144] [153] [156] [160] [161] [162] [165] [167] [172] [175] [176] [177] [178] [179] [182] [189] [198] [237] [247] [248] [268] [270] [288] [308] [310] [314] [319] [321] [322] [325] [355] [356] [357] [358] [359] [361] [362] [363] [372] [412] ::=
shelf reference [452], indexer [458]?
| NEW, new shelf item reference [453]
| NEW, "?", guarded new shelf item reference [454]

[452] shelf reference [155] [158] [159] [214] [249] [355] [358] [362] [451] [453] [454] [462] ::=
shelf name [456]
| shelf literal [450]
| record field reference [139]
| value function call [402]
| ELEMENTS, ancestry qualifier [38]
| CURRENT, ELEMENTS, ancestry qualifier [38]?

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

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

[453] new shelf item reference [169] [451] ::= shelf reference [452], key indexer [460]?, ((AFTER | BEFORE), indexer [458])?

[454] guarded new shelf item reference [169] [451] ::= shelf reference [452], key indexer [460]

[455] shelf alias [198] [206] [209] [214] [447] ::= name [471]

[456] shelf name [441] [444] [452] ::=
name [471]
| built-in shelf name [457]

[457] built-in shelf name [456] ::=
built-in read-only dtd shelf name [35]
| built-in read-only numeric shelf name [262]
| built-in read-only markup-event shelf name [37]
| built-in read-only stream shelf name [302]
| built-in read-write stream shelf name [303]
| built-in write-only stream shelf name [301]
| built-in read-only switch shelf name [334]

[458] indexer [70] [197] [269] [451] [453] ::=
item indexer [459]
| key indexer [460]
| lastmost indexer [461]

[459] item indexer [66] [270] [458] [462] ::= "[", numeric expression [238], "]"

[460] key indexer [226] [228] [248] [453] [454] [458] ::= "{", string expression [263], "}"

[461] lastmost indexer [458] ::= LASTMOST

17.3 Shelf Tests

[462] shelf test primary [325] ::=
shelf reference [452], item indexer [459]?, (IS | ISNT), KEYED
| shelf reference [452], (HAS | HASNT), KEY, string primary [268]
| REFERENTS, (HAS | HASNT), KEY, string primary [268]


18 Macros

[463] macro definition [113] ::= MACRO, macro name [464], parameter template [465]*, IS, replacement template item [470]*, MACRO-END

[464] macro name [463] ::= macro token [467]+

[465] parameter template [463] ::=
ARG, macro parameter [466], macro token [467]+
| TOKEN, macro parameter [466], macro token [467]*

[466] macro parameter [465] [467] [470] ::=
delimiter token [468]
| name [471]

[467] macro token [464] [465] ::= LITERAL?, macro parameter [466]

[468] delimiter token [466] [470] ::=
infix function name [474]
| delimiter character [469]

[469] delimiter character [468] ::= "(" | ")" | "{" | "}" | "[" | "]" | "`" | ":" | "."

[470] replacement template item [463] ::=
macro parameter [466]
| LITERAL?, string literal [272]
| LITERAL?, delimiter token [468]
| LITERAL?, name [471]
| LITERAL?, number [250]


19 Lexeme Productions

[471] name [34] [51] [96] [100] [101] [102] [103] [104] [139] [140] [316] [342] [384] [386] [392] [393] [395] [399] [415] [421] [422] [423] [424] [425] [427] [428] [455] [456] [466] [470] [474] [475] ::= letter [472], (digit [473] | letter [472] | user-defined name character [485] | "." | "-" | "_")* | "#", constant string literal [281]

[472] letter [471] ::= "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"

[473] digit [250] [471] ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

[474] infix function name [384] [468] [479] ::= infix function start character [476], function following character [478]* | name [471]

[475] prefix function name [383] [402] [403] ::= prefix function start character [477], function following character [478]* | name [471]

[476] infix function start character [474] ::= function following character [478] | prefix function start character [477]

[477] prefix function start character [475] [476] ::= "!" | "-" | "+" | "%" | "?" | "/" | "~" | "$" | "\" | "@" | "^" | ","

[478] function following character [474] [475] [476] ::= "*" | "=" | "|" | "<" | ">" | "&"


20 Dynamically-Defined Lexical Tokens

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

[480] escape [285] [286] [287] [308] [309] [310] [311] [312] [313] [314] [315] [316] [317] [318] [319] [320] [321] [322] [481] ::= The escape [480] character is defined by an escape declaration [108]. If there is no escape declaration [108], the escape character is "%".

[481] unescaped character [274] [275] [283] [284] ::= An unescaped character [481] is any character that is not a "'", a """, a control character, or escape [480].

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

[483] system-specific function name [133] [400] [409] ::= A system-specific function name [483] is implemented as a constant string expression [276].

[484] system-specific library name [133] [400] [409] ::= A system-specific library name [484] is implemented as a constant string expression [276].

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

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

Copyright © Stilo Corporation, 2003-2013. All rights reserved.
ETR62, 2013/3/19