Grammar for OmniMark 10.1

Table of Contents

Index of Productions

Notices

1 Program

[1] program unit ::=
program [2]
| module [3]

[2] program [1] ::= program type [98]?, program body [4]

[3] module [1] ::= module declaration [101], program body [4]

[4] program body [2] [3] ::= declaration [106]*, (unrestricted declaration [107] | group member [93] | identified group [91])*


2 Main Process Rules

[5] main process rule [94] ::=
process end rule [6]
| process rule [7]
| process start rule [8]

[6] process end rule [5] ::= PROCESS-END, condition [320]?, local scope [151]

[7] process rule [5] ::= PROCESS, condition [320]?, local scope [151]

[8] process start rule [5] ::= PROCESS-START, condition [320]?, local scope [151]


3 Markup Processing Rules

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

[10] data content rule [9] ::= DATA-CONTENT, condition [320]?, local scope [151]

[11] document end rule [9] ::= DOCUMENT-END, condition [320]?, local scope [151]

[12] document start rule [9] ::= DOCUMENT-START, condition [320]?, local scope [151]

[13] dtd end rule [9] ::= DTD-END, condition [320]?, local scope [151]

[14] dtd start rule [9] ::= DTD-START, condition [320]?, local scope [151]

[15] element rule [9] ::= ELEMENT, (element rule name set [31] | #IMPLIED), condition [320]?, local scope [151]

[16] epilog start rule [9] ::= EPILOG-START, condition [320]?, local scope [151]

[17] external data entity rule [9] ::= (EXTERNAL-DATA-ENTITY | EXTERNAL-ENTITY), (markup name set [35] | #IMPLIED), condition [320]?, local scope [151]

[18] invalid data rule [9] ::= INVALID-DATA, condition [320]?, local scope [151]

[19] marked section rule [9] ::= MARKED-SECTION, marked section type [29], condition [320]?, local scope [151]

[20] sgml comment processing rule [9] ::= (MARKUP-COMMENT | SGML-COMMENT), condition [320]?, local scope [151]

[21] markup error rule [94] ::= (MARKUP-ERROR | SGML-ERROR), condition [320]?, LOG?, local scope [151]

[22] processing instruction rule [9] ::= PROCESSING-INSTRUCTION, processing instruction matcher [28], condition [320]?, local scope [151]

[23] prolog end rule [9] ::= PROLOG-END, condition [320]?, local scope [151]

[24] prolog in error rule [9] ::= PROLOG-IN-ERROR, condition [320]?, local scope [151]

[25] sgml declaration end rule [9] ::= SGML-DECLARATION-END, condition [320]?, local scope [151]

[26] translation rule [9] ::= TRANSLATE, pattern expression [330], condition [320]?, local scope [151]

[27] xmlns-change rule [9] ::= XMLNS-CHANGE, condition [320]?, local scope [151]

[28] processing instruction matcher [22] ::=
pattern expression [330]
| NAMED, pattern expression [330], (VALUED, pattern expression [330])?
| VALUED, pattern expression [330], (NAMED, pattern expression [330])?

[29] marked section type [19] ::=
INCLUDE-START
| INCLUDE-END
| RCDATA
| CDATA
| IGNORE

3.1 Markup Names

[30] element name set [43] [45] [47] ::=
qualified element name [33]
| "(", qualified element name [33], ((OR | "|"), qualified element name [33])*, ")"

[31] element rule name set [15] ::=
restricted qualified element name [32]
| "(", restricted qualified element name [32], ((OR | "|"), restricted qualified element name [32])*, ")"

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

[33] qualified element name [30] [51] ::= (#BASE | #FULL | #XMLNS)?, element name [34]

[34] element name [32] [33] ::=
markup name [36]
| "~", string primary [269]

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

[35] markup name set [17] [67] ::=
markup name [36]
| "(", markup name [36], ((OR | "|"), markup name [36])*, ")"

[36] markup name [34] [35] [42] [46] [53] [74] [75] [89] ::=
constant string literal [282]
| name [468]

[37] built-in read-only dtd shelf name [351] [454] ::=
#CURRENT-DTD
| SGML-DTDS
| XML-DTDS

[38] built-in markup source name [364] ::= #CONTENT

[39] built-in read-only markup-event shelf name [350] [454] ::= #CURRENT-MARKUP-EVENT

3.2 Elements

[40] ancestry qualifier [34] [47] [71] [72] [196] [251] [269] [449] ::= OF, ancestry expression [41]

[41] ancestry expression [40] [241] ::=
ancestry secondary [42]
| PREVIOUS, (OF, ancestry secondary [42])?
| DOCTYPE

[42] ancestry secondary [41] [46] ::=
ancestry primary [43], (OF, ancestry secondary [42])?
| markup event primary [350]
| CURRENT, ELEMENT, markup name [36]

[43] ancestry primary [42] ::=
ANCESTOR, element name set [30]
| OPEN, ELEMENT, element name set [30]
| PREPARENT, element name set [30]
| ELEMENT
| PARENT

3.2.1 Element Tests

[44] element test primary [322] ::=
element identity test primary [45]
| element property test primary [47]

[45] element identity test primary [44] ::= element test ancestry identifier [46], (IS | ISNT), element name set [30]

[46] element test ancestry identifier [45] ::=
(ANCESTOR | OPEN, ELEMENT | PREPARENT | PARENT | ELEMENT | PREVIOUS), (OF, ancestry secondary [42])?
| DOCTYPE
| CURRENT, ELEMENT, markup name [36]

[47] element property test primary [44] ::=
CONTENT, ancestry qualifier [40]?, (IS | ISNT), content type set [48]
| LAST, PROPER?, CONTENT, ancestry qualifier [40]?, (IS | ISNT), element name or data set [50]
| LAST, PROPER?, SUBELEMENT, ancestry qualifier [40]?, (IS | ISNT), element name set [30]
| PREVIOUS, ancestry qualifier [40]?, (IS | ISNT), element name set [30]
| STATUS, (OF, LAST, SUBELEMENT)?, ancestry qualifier [40]?, (IS | ISNT), (PROPER | INCLUSION)
| USEMAP, ancestry qualifier [40]?, (IS | ISNT), short reference map name set [52]

[48] content type set [47] ::=
content type [49]
| "(", content type [49], ((OR | "|"), content type [49])*, ")"

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

[50] element name or data set [47] ::=
element name or data [51]
| "(", element name or data [51], ((OR | "|"), element name or data [51])*, ")"

[51] element name or data [50] ::=
qualified element name [33]
| #DATA

[52] short reference map name set [47] ::=
short reference map name [53]
| "(", short reference map name [53], ((OR | "|"), short reference map name [53])*, ")"

[53] short reference map name [52] ::=
markup name [36]
| name [468]
| #EMPTY
| #NONE

3.3 Entity and Notation Tests

[54] entity test primary [322] ::=
qualified attribute part identifier [68], (IS | ISNT), entity category set [57]
| ENTITY, (IS | ISNT), entity category set [57]
| notation selector [56], (IS | ISNT), notation category set [59]
| notation selector [56], equivalence comparer [324], notation name set [67]

[55] entity selector [56] ::=
ENTITY
| qualified attribute part identifier [68]

[56] notation selector [54] ::= NOTATION, (OF, entity selector [55])?

[57] entity category set [54] ::=
entity category [58]
| "(", entity category [58], ((AND | "&"), entity category [58])*, ")"
| "(", entity category [58], ((OR | "|"), entity category [58])*, ")"

[58] entity category [57] ::=
anonymous entity type [65]
| default entity type [64]
| entity class [63]
| entity scope [66]
| entity type [62]
| external identifier type [61]

[59] notation category set [54] ::= notation category [60]

[60] notation category [59] ::= external identifier type [61]

[61] external identifier type [58] [60] ::=
PUBLIC
| SYSTEM
| IN-LIBRARY

[62] entity type [58] ::=
CDATA-ENTITY
| NDATA-ENTITY
| SDATA-ENTITY
| SUBDOC-ENTITY

[63] entity class [58] ::=
GENERAL
| PARAMETER

[64] default entity type [58] ::= DEFAULT-ENTITY

[65] anonymous entity type [58] [89] [90] ::=
#CAPACITY
| #CHARSET
| #DOCUMENT
| #DTD
| #SCHEMA
| #SYNTAX

[66] entity scope [58] ::=
INTERNAL
| EXTERNAL

[67] notation name set [54] ::= markup name set [35]

3.4 Attributes

[68] qualified attribute part identifier [54] [55] [69] [70] [71] [72] [269] [358] ::=
(simple qualified attribute set identifier [72], indexer [455] | DATA-ATTRIBUTE, attribute name [75], OF, qualified attribute part identifier [68])
| simple qualified attribute identifier [71], item indexer [456]?

[69] qualified attribute identifier [81] [196] [218] [253] [271] ::=
(simple qualified attribute set identifier [72], indexer [455] | DATA-ATTRIBUTE, attribute name [75], OF, qualified attribute part identifier [68])
| simple qualified attribute identifier [71]

[70] qualified attribute set identifier [82] [218] [253] ::=
attribute subset specifier [73]?, DATA-ATTRIBUTES, OF, qualified attribute part identifier [68]
| simple qualified attribute set identifier [72]

[71] simple qualified attribute identifier [68] [69] [196] ::=
ATTRIBUTE, attribute name [75], ancestry qualifier [40]?
| DATA-ATTRIBUTE, attribute name [75], (OF, "(", qualified attribute part identifier [68], ")")?

[72] simple qualified attribute set identifier [68] [69] [70] [252] ::=
attribute subset specifier [73]?, ATTRIBUTES, ancestry qualifier [40]?
| attribute subset specifier [73]?, DATA-ATTRIBUTES, (OF, "(", qualified attribute part identifier [68], ")")?

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

[74] attribute alias [218] ::= markup name [36]

[75] attribute name [68] [69] [71] [196] [306] ::= markup name [36]

[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 [322] ::= qualified attribute identifier [69], (IS | ISNT), attribute type set [76]

[82] attributes test primary [322] ::= qualified attribute set identifier [70], (HAS | HASNT), KEY, string primary [269]


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 [320]?, local scope [151]

[85] find rule [83] ::= FIND, NULL?, pattern expression [330], condition [320]?, local scope [151]

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

[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 [320]?, local scope [151]

[89] extended entity name [87] ::=
markup name [36]
| anonymous entity type [65]

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


5 Groups

[91] identified group [4] ::=
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 [4] [91] ::=
include [99]
| rule [94]

[94] rule [93] ::=
markup processing rule [9]
| input processing rule [83]
| line breaking rule [127]
| main process rule [5]
| markup error rule [21]

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

[96] group name [95] ::=
constant string literal [282]
| name [468]

[97] current group set [174] [197] ::=
group name set [95]
| (group name set [95], (AND | "&"))?, #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 [282]

[100] include guard declaration [115] ::= INCLUDE-GUARD, (constant string literal [282] | name [468])

7.2 Modules

[101] module declaration [3] ::=
MODULE, (SHARED, AS, (constant string literal [282] | name [468]))?
| MODULE, INTERFACE, SHARED, AS, (constant string literal [282] | name [468])
| MODULE, IMPLEMENTS, constant string literal [282]

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

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

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

7.3 Accessing Text Files

[105] library declaration [115] ::= LIBRARY, (constant string expression [277], constant string expression [277])+


8 Declarations

[106] declaration [4] ::=
naming declaration [119]
| program-level declaration [108]
| unrestricted declaration [107]

[107] unrestricted declaration [4] [106] ::=
common declaration [115]
| global object definition [116]
| global stream declaration [109]

[108] program-level declaration [106] ::=
default io declaration [110]
| escape declaration [111]

[109] global stream declaration [107] ::=
main buffering declaration [112]
| main mode declaration [113]
| main output referent declaration [114]

[110] default io declaration [108] ::= DECLARE, NO-DEFAULT-IO

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

[111] escape declaration [108] [477] ::= ESCAPE, constant string primary [280]

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

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

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

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

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

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

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

[115] common declaration [107] ::=
binary input declaration [117]
| binary output declaration [118]
| break-width declaration [126]
| delimiter declaration [303]
| external function library declaration [150]
| import declaration [102]
| include guard declaration [100]
| library declaration [105]
| macro definition [460]
| markup identification declaration [123]
| symbol declaration [302]

[116] global object definition [107] ::=
catch definition [409]
| function definition [371]
| global shelf definition [436]
| require function definition [383]
| require shelf definition [437]
| user-defined type declaration [133]

[117] binary input declaration [115] ::= BINARY-INPUT, constant numeric expression [256]

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

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

[118] binary output declaration [115] ::= BINARY-OUTPUT, constant numeric expression [256]

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

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

8.1 Naming Declarations

[119] naming declaration [106] ::=
data letters declaration [120]
| entity namecase declaration [121]
| general namecase declaration [122]
| name letters declaration [124]
| newline declaration [125]

[120] data letters declaration [119] ::=
DECLARE, DATA-LETTERS, constant string expression [277], constant string expression [277]?
| LETTERS, constant string expression [277], constant string expression [277]?

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

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

entity namecase declaration [121] is deprecated.

[122] general namecase declaration [119] ::= NAMECASE, GENERAL, (YES | NO)

general namecase declaration [122] is deprecated.

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

[124] name letters declaration [119] ::= DECLARE, NAME-LETTERS, constant string expression [277], constant string expression [277]

[125] newline declaration [119] ::= NEWLINE, constant string expression [277]

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

8.2 Line-breaking Declarations

[126] break-width declaration [115] ::= BREAK-WIDTH, constant numeric expression [256], (number [254] | TO, constant numeric expression [256])?

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

[127] line breaking rule [94] ::=
insertion break rule [128]
| replacement break rule [129]

[128] insertion break rule [127] ::= INSERTION-BREAK, constant string expression [277], condition [320]?

[129] replacement break rule [127] ::= REPLACEMENT-BREAK, constant string primary [280], constant string expression [277], condition [320]?


9 Types

[130] type [372] [373] [374] [375] [376] [377] [380] [383] [388] [393] ::=
first-class type [131]
| qualified type [132]

[131] first-class type [130] [389] [391] [392] [437] [443] [447] ::=
user-defined type name [143]
| 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.

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

9.1 User-Defined Types

[133] user-defined type declaration [116] ::=
opaque type declaration [134]
| record type declaration [137]
| user-defined type require [141]

[134] opaque type declaration [133] ::= (DECLARE | EXPORT), (ABSTRACT, OPAQUE, user-defined type name [143], opaque type inheritance clause [136]? | OPAQUE, user-defined type name [143], opaque type inheritance clause [136]?, opaque type declaration binding [135])

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

[135] opaque type declaration binding [134] ::= CREATED, BY, system-specific function name [480], (IN, FUNCTION-LIBRARY, system-specific library name [481])?

[136] opaque type inheritance clause [134] ::= EXTENDS, user-defined type name [143]

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

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

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

[138] record type declaration binding [137] ::=
field declaration [140]*
| ELSEWHERE

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

[139] record type inheritance clause [137] ::= EXTENDS, user-defined type name [143]

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

[140] field declaration [138] ::= FIELD, shelf declaration [443]

[141] user-defined type require [133] ::= REQUIRE, OPAQUE, user-defined type name [143]

[142] record field reference [202] [218] [449] ::= user-defined type instance [147], ":", name [468]

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

[143] user-defined type name [131] [134] [136] [137] [139] [141] [146] [210] [407] ::= name [468]

[144] user-defined type expression [147] [348] ::= expression [234]

[145] user-defined type subexpression [148] ::=
argument primary [404], (user-defined infix function name [476], argument primary [404])+
| user-defined type primary [146]

[146] user-defined type primary [145] ::=
user-defined type name [143], CAST, user-defined type primary [146]
| value function call [398]
| user-defined type instance [147]

[147] user-defined type instance [142] [146] ::=
shelf item reference [448]
| "(", user-defined type expression [144], ")"

[148] user-defined type test primary [322] ::= user-defined type subexpression [145], (reference comparer [149], user-defined type subexpression [145])+

[149] reference comparer [148] ::=
"=="
| "!=="

[150] external function library declaration [115] ::= DECLARE, FUNCTION-LIBRARY, constant string expression [277]


10 Actions

[151] local scope [6] [7] [8] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [84] [85] [86] [88] [203] [204] [206] [207] [210] [211] [212] [217] [220] [221] [223] [224] [329] [397] ::= local declaration [439]*, action [154]*, catch alternative [153]*, always block [152]*

[152] always block [151] ::= ALWAYS, action [154]*

[153] catch alternative [151] ::= CATCH, (built-in catch invocation [416] | catch invocation [422]), action [154]*

[154] action [151] [152] [153] ::= using prefix [195]*, guarded action [155]

[155] guarded action [154] ::= basic action [156], condition [320]?

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

[157] activate action [156] ::= ACTIVATE, shelf item reference [448], ((AND | "&"), shelf item reference [448])*

[158] assert action [156] ::= ASSERT, boolean expression [321], (MESSAGE, expression [234])?

[159] clear action [156] ::= CLEAR, shelf reference [449], ((AND | "&"), shelf reference [449])*

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

[161] collect garbage action [156] ::= COLLECT-GARBAGE

[162] copy action [156] ::= COPY, shelf reference [449], TO, shelf reference [449]

[163] copy and clear action [156] ::= COPY-CLEAR, shelf reference [449], TO, shelf reference [449]

[164] deactivate action [156] ::= DEACTIVATE, shelf item reference [448], ((AND | "&"), shelf item reference [448])*

[165] decrement action [156] ::= DECREMENT, shelf item reference [448], (BY, numeric expression [242])?

[166] discard action [156] ::= DISCARD, shelf item reference [448], ((AND | "&"), shelf item reference [448])*

[167] exit action [156] ::= EXIT

[168] fail action [156] ::= FAIL

[169] flush action [156] ::= FLUSH, shelf item reference [448], ((AND | "&"), shelf item reference [448])*

[170] halt action [156] ::= (HALT | HALT-EVERYTHING), (WITH, numeric expression [242])?

[171] increment action [156] ::= INCREMENT, shelf item reference [448], (BY, numeric expression [242])?

[172] log-message action [156] ::= LOG-MESSAGE, string expression [264]

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

[173] new action [156] ::=
NEW, new shelf item reference [450], ((AND | "&"), new shelf item reference [450])*
| NEW, "?", guarded new shelf item reference [451], ((AND | "&"), guarded new shelf item reference [451])*

[174] next group action [156] ::= NEXT, GROUP, IS, (current group set [97] | "(", current group set [97], ")")

[175] not reached action [156] ::= NOT-REACHED, (MESSAGE, string expression [264])?

[176] open action [156] ::= OPEN, shelf item reference [448], modifier expression [427]?, AS, string sink literal for open [369], modifier expression [427]?

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

[177] output action [156] ::= OUTPUT, string source expression [365]

[178] output to action [156] ::= OUTPUT-TO, string sink expression [367]

[179] put action [156] ::= PUT, shelf item reference [448], ((AND | "&"), shelf item reference [448])*, string expression [264]

[180] remove action [156] ::= REMOVE, shelf item reference [448]

[181] remove key action [156] ::= REMOVE, KEY, OF, shelf item reference [448]

[182] reopen action [156] ::= REOPEN, shelf item reference [448], modifier expression [427]?, (AS, string sink literal for open [369], modifier expression [427]?)?

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

[183] reset action [156] ::= RESET, shelf item reference [448], (TO, numeric expression [242])?

[184] return action [156] ::= RETURN, expression [234]?

[185] set action [156] ::= SET, string sink primary [368], TO, expression [234]

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

[186] set key action [156] ::= SET, KEY, OF, shelf item reference [448], TO, string expression [264]

[187] sgml in action [156] ::= SGML-IN, (string expression [264] | #NONE)

[188] sgml out action [156] ::= SGML-OUT, (string expression [264] | #NONE)

[189] submit action [156] ::= SUBMIT, string source expression [365]

[190] succeed action [156] ::= SUCCEED

[191] suppress action [156] ::= SUPPRESS

[192] test system action [156] ::= TEST-SYSTEM, (WITH, string expression [264])?

[193] throw action [156] ::= (SIGNAL, (TO, shelf item reference [448])?)?, (THROW, throw invocation [425] | RETHROW)

[194] void action [156] ::= VOID, expression [234]


11 Using

[195] using prefix [154] ::=
using attribute association prefix [196]
| using group prefix [197]
| using input prefix [198]
| using nested-referents prefix [199]
| using output prefix [200]
| using referents association prefix [201]
| using shelf item association prefix [202]

[196] using attribute association prefix [195] ::= USING, qualified attribute identifier [69], (AS, attribute name [75])?

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

[197] using group prefix [195] ::=
USING, GROUP, current group set [97]
| USING, GROUP, "(", current group set [97], ")"

[198] using input prefix [195] ::= USING, INPUT, AS, string expression [264]

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

[200] using output prefix [195] ::= USING, OUTPUT, AS, string sink expression [367]

[201] using referents association prefix [195] ::= USING, REFERENTS, indexer [455]

[202] using shelf item association prefix [195] ::= USING, shelf item reference [448], (AS, shelf alias [452])?

If shelf item reference [448] contains a shelf literal [446] or a record field reference [142], the shelf alias [452] is required.


12 Block Constructs

[203] do action [156] ::= DO, local scope [151], DONE

[204] do conditional action [156] ::= DO, condition [320], local scope [151], (ELSE, condition [320], local scope [151])*, (ELSE, local scope [151], DONE)?

[205] do markup parse action [156] ::=
do generic parse action [223]
| do sgml parse action [221]
| do xml parse action [224]

[206] do scan action [156] ::= DO, SCAN, string source expression [365], match alternative [220]+, (ELSE, local scope [151])?, DONE

[207] do select action [156] ::= DO, SELECT, numeric expression [242], (CASE, constant numeric range set [208], local scope [151])+, (ELSE, local scope [151])?, DONE

[208] constant numeric range set [207] ::=
constant numeric range [209], ((OR | "|"), constant numeric range [209])*
| "(", constant numeric range [209], ((OR | "|"), constant numeric range [209])*, ")"

[209] constant numeric range [208] ::= constant numeric expression [256], (TO, constant numeric expression [256])?

[210] do select-type action [156] ::= DO, SELECT-TYPE, hierarchical type expression [348], AS, shelf alias [452], (CASE, user-defined type name [143], local scope [151])+, (ELSE, local scope [151])?, DONE

[211] do skip action [156] ::= DO, SKIP, (OVER, pattern expression [330] | PAST, numeric expression [242], (OVER, pattern expression [330])?), local scope [151], (ELSE, local scope [151])?, DONE

[212] repeat action [156] [216] ::= REPEAT, for part [213]?, from part [214]?, to part [215]?, by part [216]?, local scope [151], AGAIN

[213] for part [212] [216] ::= FOR, INTEGER, shelf alias [452]

[214] from part [212] [216] ::= FROM, numeric expression [242]

[215] to part [212] [216] ::= TO, numeric expression [242]

[216] by part [212] ::= BY, numeric expression [242]

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

[217] repeat over action [156] [329] ::= REPEAT, OVER, repeat over component [218], ((AND | "&"), repeat over component [218])*, local scope [151], AGAIN

[218] repeat over component [217] ::=
qualified attribute identifier [69], (AS, attribute alias [74])?
| qualified attribute set identifier [70], AS, attribute alias [74]
| REVERSED?, shelf reference [449], (AS, shelf alias [452])?
| REFERENTS

If shelf reference [449] is a shelf literal [446], a record field reference [142], or a reference to CURRENT ELEMENTS, the shelf alias [452] is required.

[219] repeat scan action [156] ::= REPEAT, SCAN, string expression [264], match alternative [220]+, AGAIN

[220] match alternative [206] [219] ::= MATCH, UNANCHORED?, NULL?, pattern expression [330], condition [320]?, local scope [151]

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

12.1 Markup Parse Actions

[221] do sgml parse action [205] ::= DO, SGML-PARSE, sgml parse type [222], SCAN, markup parse scanning source [233], local scope [151], DONE

[222] sgml parse type [221] ::=
(DOCUMENT | SUBDOCUMENT), id checking specifier [226]?, utf8 specifier [228]?, (CREATING, sgml dtd shelf item [230])?
| INSTANCE, instance element specifier [227]?, sgml dtd specifier [229], id checking specifier [226]?, utf8 specifier [228]?

[223] do generic parse action [205] ::= DO, MARKUP-PARSE, markup source expression [363], local scope [151], DONE

[224] do xml parse action [205] ::= DO, XML-PARSE, xml parse type [225]?, SCAN, markup parse scanning source [233], local scope [151], DONE

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

[225] xml parse type [224] ::=
DOCUMENT, id checking specifier [226]?, utf8 specifier [228]?, (CREATING, xml dtd shelf item [232])?
| INSTANCE, (instance element specifier [227]?, xml dtd specifier [231])?, id checking specifier [226]?, utf8 specifier [228]?

[226] id checking specifier [222] [225] ::= WITH, ID-CHECKING, boolean expression [321]

[227] instance element specifier [222] [225] ::= WITH, DOCUMENT-ELEMENT, string expression [264]

[228] utf8 specifier [222] [225] ::= WITH, UTF-8, boolean expression [321]

[229] sgml dtd specifier [222] ::= WITH, (sgml dtd shelf item [230] | CURRENT, (DTD | SGML-DTD))

[230] sgml dtd shelf item [222] [229] ::= (DTDS | SGML-DTDS), key indexer [457]

[231] xml dtd specifier [225] ::= WITH, (xml dtd shelf item [232] | CURRENT, XML-DTD)

[232] xml dtd shelf item [225] [231] ::= XML-DTDS, key indexer [457]

12.1.1 Markup Parse Support

[233] markup parse scanning source [221] [224] ::=
INPUT, void function call [399]
| string source expression [365]

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


13 Expressions

[234] expression [144] [158] [184] [185] [194] [241] [242] [264] [321] [349] [351] [352] [353] [354] [356] [357] [358] [360] [363] [365] [367] [388] [403] [447] ::= conditional expression [235], ((OR | "|"), conditional expression [235])*

[235] conditional expression [234] ::=
conjunctive expression [236], "->", conditional expression [235], "|", conditional expression [235]
| conjunctive expression [236]

[236] conjunctive expression [235] ::= factor expression [237], ((AND | "&"), factor expression [237])*

[237] factor expression [236] ::= (NOT | "!")?, comparison expression [238]

[238] comparison expression [237] ::= subexpression [239], ((equality comparer [325], subexpression [239])+ | inequality comparer [326], subexpression [239])?

[239] subexpression [238] [243] [265] ::=
numeric term [245], (numeric additive operator [244], numeric term [245])*
| string term [266], ((JOIN | "||"), string term [266])*
| expression secondary [240]

[240] expression secondary [239] [268] ::= expression primary [241], (user-defined infix function name [476], argument primary [404])+

[241] expression primary [240] [404] ::=
ancestry expression [41]
| attribute declaration primary [355]
| attribute default declaration primary [356]
| attribute value declaration primary [357]
| attribute primary [358]
| boolean primary [322]
| content model primary [354]
| dtd primary [351]
| element declaration primary [353]
| entity declaration primary [352]
| markup event primary [350]
| markup sink primary [361]
| markup source primary [364]
| numeric primary [251]
| string primary [269]
| string sink primary [368]
| string source primary [366]
| shelf item reference [448]
| value function call [398]
| "(", expression [234], ")"

13.1 Numeric Expressions

[242] numeric expression [165] [170] [171] [183] [207] [211] [214] [215] [216] [251] [340] [456] ::= expression [234]

[243] numeric subexpression [262] [266] [267] [433] [435] ::= subexpression [239]

[244] numeric additive operator [239] [256] ::=
PLUS
| "+"
| MINUS
| "-"
| UNION
| DIFFERENCE

[245] numeric term [239] ::= numeric factor [247], (numeric multiplicative operator [246], numeric factor [247])*

[246] numeric multiplicative operator [245] [257] ::=
TIMES
| "*"
| DIVIDE
| "/"
| MODULO
| MASK
| SHIFT

[247] numeric factor [245] ::= numeric tertiary [248], ("**", numeric factor [247])?

[248] numeric tertiary [247] ::=
numeric secondary [250]
| string secondary [268], (numeric conversion operator [249], numeric secondary [250])?

[249] numeric conversion operator [248] [259] ::=
BASE
| BINARY

[250] numeric secondary [248] ::=
argument primary [404], (user-defined infix function name [476], argument primary [404])+
| numeric primary [251]

[251] numeric primary [241] [250] ::=
value function call [398]
| string primary [269]
| (NEGATE | "-"), numeric primary [251]
| COMPLEMENT, numeric primary [251]
| shelf item reference [448]
| BINARY, string primary [269]
| CHILDREN, ancestry qualifier [40]?
| ITEM, OF, item-of reference [252]
| LENGTH, OF, string primary [269]
| (NUMBER, OF | NUMBER-OF), number-of reference [253]
| OCCURRENCE, ancestry qualifier [40]?
| SYSTEM-CALL, string primary [269]
| number [254]
| "(", numeric expression [242], ")"

[252] item-of reference [251] ::=
shelf item reference [448]
| simple qualified attribute set identifier [72], key indexer [457]
| REFERENTS, key indexer [457]
| THIS, REFERENT

[253] number-of reference [251] ::=
qualified attribute identifier [69]
| qualified attribute set identifier [70]
| shelf reference [449]
| CURRENT, SUBDOCUMENTS
| REFERENTS

[254] number [126] [251] [260] [287] [288] [305] [306] [307] [310] [311] [315] [316] [318] [319] [435] [467] [479] ::= natural number [255], (".", natural number [255])?

[255] natural number [254] ::= digit [470]+, ("_", digit [470]+)*

13.1.1 Constant Numeric Expressions

[256] constant numeric expression [117] [118] [126] [209] [260] [279] [444] [445] ::= constant numeric term [257], (numeric additive operator [244], constant numeric term [257])*

[257] constant numeric term [256] ::= constant numeric factor [258], (numeric multiplicative operator [246], constant numeric factor [258])*

[258] constant numeric factor [257] ::= constant numeric secondary [259], ("**", constant numeric factor [258])?

[259] constant numeric secondary [258] ::=
constant numeric primary [260]
| constant string primary [280], numeric conversion operator [249], constant numeric primary [260]

[260] constant numeric primary [259] [278] ::=
constant string primary [280]
| (NEGATE | "-"), constant numeric primary [260]
| COMPLEMENT, constant numeric primary [260]
| BINARY, constant string primary [280]
| LENGTH, OF, constant string primary [280]
| number [254]
| "(", constant numeric expression [256], ")"

13.1.2 Numeric Tests

[261] numeric test primary [322] ::= VALUE?, numeric comparison [262]

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

[262] numeric comparison [261] ::= numeric subexpression [243], (comparer [323], numeric subexpression [243])+

13.1.3 Built-In Numeric Shelves

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

[264] string expression [172] [175] [179] [186] [187] [188] [192] [198] [219] [227] [269] [293] [434] [457] ::= expression [234]

[265] string subexpression [293] [294] ::= subexpression [239]

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

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

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

[268] string secondary [248] [267] ::=
expression secondary [240]
| string primary [269]

[269] string primary [34] [82] [241] [251] [268] [270] [295] [335] [350] [353] [356] [358] [370] [459] ::=
stream input/output mode [272]?, value function call [398]
| constant string value [281]
| external function association enquiry [406]
| pattern name [337]
| qualified attribute part identifier [68]
| referent item reference [270]
| shelf item reference [448]
| stream input/output mode [272]?, FILE, string primary [269]
| DATE, string primary [269]
| KEY, OF, key-of reference [271]
| NAME, OF, shelf item reference [448]
| NAME, OF, element declaration primary [353]
| NAME, ancestry qualifier [40]
| XMLNS-NAME, ancestry qualifier [40]?
| "~", string primary [269]
| string literal [273]
| "(", string expression [264], ")"

[270] referent item reference [269] [370] ::=
REFERENTS, indexer [455]
| THIS, REFERENT
| REFERENT, string primary [269]
| SILENT-REFERENT, string primary [269]

[271] key-of reference [269] ::=
qualified attribute identifier [69]
| shelf item reference [448]
| REFERENTS, item indexer [456]
| THIS, REFERENT

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

13.2.1 String Literals

[273] string literal [269] [335] [467] ::= string literal part [274], ("_", string literal part [274])*

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

[275] double-quoted string literal part [274] ::= """, (described character [287] | described substring [288] | escaped text [286] | format item [304] | unescaped character [478] | "'")*, """

[276] single-quoted string literal part [274] ::= "'", (described character [287] | described substring [288] | escaped text [286] | format item [304] | unescaped character [478] | """)*, "'"

13.2.2 Constant String Expressions

[277] constant string expression [105] [120] [124] [125] [128] [129] [150] [280] [302] [303] [480] [481] ::= constant string term [278], ((JOIN | "||"), constant string term [278])*

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

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

[280] constant string primary [111] [129] [259] [260] [279] [281] ::=
constant string value [281]
| constant string literal [282]
| "(", constant string expression [277], ")"

[281] constant string value [269] [280] ::= COMPILED-DATE, constant string primary [280]

[282] constant string literal [36] [96] [99] [100] [101] [102] [280] [345] [433] [468] ::= constant string literal part [283], ("_", constant string literal part [283])*

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

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

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

[286] escaped text [275] [276] [284] [285] ::= escape [477], (escape [477] | """ | "'" | "#" | ")")

[287] described character [275] [276] [284] [285] ::=
escape [477], "_"
| escape [477], "n"
| escape [477], "t"
| escape [477], number [254], "#"

[288] described substring [275] [276] [284] [285] [479] ::= escape [477], number [254], "r", "{", describing number [479], (",", describing number [479])*, "}"

13.2.3 Stream Tests

[289] stream test primary [322] ::=
shelf item reference [448], (HAS | HASNT), NAME
| shelf item reference [448], (IS | ISNT), stream type set [290]

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

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

[292] string test primary [322] ::=
string comparison [293]
| string match test primary [294]

[293] string comparison [292] ::= string subexpression [265], (comparer [323], UL?, string subexpression [265])*, (comparer [323], UL?, (string subexpression [265] | "(", string expression [264], ((OR | "|"), string expression [264])*, ")"))*

[294] string match test primary [292] ::= string subexpression [265], MATCHES, UNANCHORED?, pattern secondary [334]

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

13.2.5 Source Tests

[295] source test primary [322] ::=
FILE, string primary [269], EXISTS
| FILE, string primary [269], (IS | ISNT), file info enquiry set [296]
| #CURRENT-INPUT, (IS | ISNT), ATTACHED

[296] file info enquiry set [295] ::=
file info enquiry [297]
| "(", file info enquiry [297], ((AND | "&"), file info enquiry [297])*, ")"

[297] file info enquiry [296] ::=
DIRECTORY
| FILE
| READABLE
| WRITABLE

13.2.6 Built-In Stream Shelves

[298] built-in write-only stream shelf name [454] ::=
#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.

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

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

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

13.2.7 Formatting Declarations

[302] symbol declaration [115] ::= SYMBOL, constant string expression [277]+

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

[303] delimiter declaration [115] ::= DELIMITER, constant string expression [277]

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

13.2.8 Format Items

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

[305] alphabetic format item [304] ::= escape [477], (number [254], "f" | "j" | "k" | "l" | "u" | "w")*, "a", "(", shelf item reference [448], ")"

[306] attribute format item [304] ::= escape [477], (number [254], "f" | "k" | "e" | "h" | "l" | "o" | "p" | "s" | "u" | "z")*, "v", "(", attribute name [75], ")"

[307] binary format item [304] ::= escape [477], (number [254], "f" | number [254])*, "b", "(", shelf item reference [448], ")"

[308] break format item [304] ::= escape [477], "/"

[309] content format item [304] ::= escape [477], ("h" | "l" | "s" | "u" | "z")*, "c"

[310] current name format item [304] ::= escape [477], ("e" | number [254], "f" | "k" | "l" | "o" | "p" | "u")*, "q"

[311] decimal format item [304] ::= escape [477], (number [254], "f" | ("k" | "z") | "l" | number [254], "r" | "s" | "u" | number [254])*, "d", "(", shelf item reference [448], ")"

[312] end break suppress format item [304] ::= escape [477], "]"

[313] macro format item [304] ::= escape [477], ("u" | "l")?, "@", (escape [477] | "(", name [468], ")")

[314] other format item [304] ::=
escape [477], "s", "_"
| escape [477], "s", "n"
| escape [477], "s", "t"
| escape [477], "e", "n"

[315] pattern format item [304] ::= escape [477], (number [254], "f" | "k" | "h" | "l" | "s" | "u")*, "x", "(", pattern name [337], ")"

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

[316] roman format item [304] ::= escape [477], (number [254], "f" | "k" | "l" | "u")*, "i", "(", shelf item reference [448], ")"

[317] start break suppress format item [304] ::= escape [477], "["

[318] stream format item [304] [315] ::= escape [477], (number [254], "f" | "k" | "l" | "u" | "e")*, "g", "(", (shelf item reference [448] | pattern name [337]), ")"

[319] symbol format item [304] ::= escape [477], (number [254], "f" | "k")*, "y", "(", shelf item reference [448], ")"

13.3 Boolean Expressions

[320] condition [6] [7] [8] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [84] [85] [86] [88] [128] [129] [155] [204] [220] [335] ::= (WHEN | UNLESS), boolean expression [321]

[321] boolean expression [158] [226] [228] [320] [322] ::= expression [234]

[322] boolean primary [241] [335] [355] ::=
shelf item reference [448]
| value function call [398]
| FALSE
| TRUE
| "~", boolean primary [322]
| argument test primary [408]
| attribute test primary [81]
| attributes test primary [82]
| catch test primary [426]
| element test primary [44]
| entity test primary [54]
| numeric test primary [261]
| pattern test primary [347]
| shelf test primary [459]
| source test primary [295]
| stream test primary [289]
| string test primary [292]
| user-defined type test primary [148]
| ACTIVE, boolean primary [322]
| "(", boolean expression [321], ")"

Use of the ACTIVE keyword is unnecessary and is deprecated.

[323] comparer [262] [293] ::=
equivalence comparer [324]
| ascending comparer [327]
| descending comparer [328]

[324] equivalence comparer [54] [323] ::=
equality comparer [325]
| inequality comparer [326]

[325] equality comparer [238] [324] ::=
IS, EQUAL
| "="

[326] inequality comparer [238] [324] ::=
ISNT, EQUAL
| "!", "="

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

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

13.3.1 Built-In Switch Shelves

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

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

13.4 Pattern Expressions

[330] pattern expression [26] [28] [85] [211] [220] [335] ::= pattern product [331], ((OR | "|"), pattern product [331])*

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

[332] pattern factor [331] ::=
(pattern entity type [338] | pattern nonentity type [339])?, pattern tertiary [333]
| pattern entity type [338], NAMED, pattern tertiary [333], (VALUED, pattern tertiary [333])?
| pattern entity type [338], VALUED, pattern tertiary [333], (NAMED, pattern tertiary [333])?

[333] pattern tertiary [332] ::= pattern prefix modifier [336]*, pattern secondary [334], ("=>", pattern name [337])?

[334] pattern secondary [266] [294] [333] ::= pattern primary [335], occurrence indicator [340]?

[335] pattern primary [334] ::=
character class name [341]
| character set [342]
| string literal [273]
| positional pattern [346]
| ANOTHER?, pattern name [337]
| value function call [398]
| "~", string primary [269]
| "~", boolean primary [322]
| "(", condition [320], ")"
| "(", pattern expression [330], condition [320]?, ")"

[336] pattern prefix modifier [331] [333] ::=
LOOKAHEAD
| LOOKAHEAD, NOT
| UL

[337] pattern name [269] [315] [318] [331] [333] [335] [347] ::= name [468]

[338] pattern entity type [332] ::=
CDATA
| SDATA
| ENTITY

[339] pattern nonentity type [332] ::=
PCDATA
| NON-CDATA
| NON-SDATA
| TEXT

[340] occurrence indicator [334] ::=
"?"
| "+"
| "*"
| "{", numeric expression [242], "}"
| "{", numeric expression [242], TO, numeric expression [242], "}"
| "{", numeric expression [242], "}", "+"

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

[342] character set [331] [335] ::=
"[", character set term [344], (character set exception operator [343], character set term [344])?, "]"
| "[", character set exception operator [343], character set term [344], "]"

[343] character set exception operator [342] ::=
"\"
| EXCEPT

[344] character set term [342] ::= character set product [345], ((OR | "|"), character set product [345])*

[345] character set product [344] ::=
character class name [341]
| constant string literal [282], (TO, constant string literal [282])?

[346] positional pattern [335] ::=
CONTENT-END
| CONTENT-START
| LINE-END
| LINE-START
| VALUE-END
| VALUE-START
| WORD-END
| WORD-START

13.4.1 Pattern Tests

[347] pattern test primary [322] ::= pattern name [337], (IS | ISNT), SPECIFIED

[348] hierarchical type expression [210] ::=
markup event expression [349]
| user-defined type expression [144]

13.5 Markup Events

[349] markup event expression [348] [350] ::= expression [234]

[350] markup event primary [42] [241] [353] [425] [449] ::=
built-in read-only markup-event shelf name [39]
| CREATE-ELEMENT-EVENT, element declaration primary [353], (ATTRIBUTES, shelf reference [449])?
| CREATE-PROCESSING-INSTRUCTION-EVENT, string primary [269]
| shelf item reference [448]
| value function call [398]
| "(", markup event expression [349], ")"

13.6 Markup Declarations

[351] dtd primary [241] [352] [353] ::=
built-in read-only dtd shelf name [37]
| shelf item reference [448]
| value function call [398]
| "(", expression [234], ")"

[352] entity declaration primary [241] ::=
DECLARED-GENERAL-ENTITIES, OF, dtd primary [351]
| DECLARED-PARAMETER-ENTITIES, OF, dtd primary [351]
| shelf item reference [448]
| value function call [398]
| "(", expression [234], ")"

[353] element declaration primary [241] [269] [350] [354] [355] [357] ::=
CREATE-ELEMENT-DECLARATION, string primary [269], ATTRIBUTES, shelf reference [449], CONTENT, content model primary [354]
| DECLARATION, OF, markup event primary [350]
| DECLARED-ELEMENTS, OF, dtd primary [351]
| shelf item reference [448]
| value function call [398]
| "(", expression [234], ")"

[354] content model primary [241] [353] ::= (ELEMENT-CONTENT-MODEL | MIXED-CONTENT-MODEL | ANY-CONTENT-MODEL | EMPTY-CONTENT-MODEL | CDATA-CONTENT-MODEL | RCDATA-CONTENT-MODEL | CONTENT, OF, element declaration primary [353] | shelf item reference [448] | value function call [398] | "(", expression [234], ")")

[355] attribute declaration primary [241] [358] ::= (CREATE-ATTRIBUTE-DECLARATION, attribute value declaration primary [357], DEFAULT, attribute default declaration primary [356], (CASE-SENSITIVE, boolean primary [322])? | ATTRIBUTES, OF, element declaration primary [353])

[356] attribute default declaration primary [241] [355] ::= (ATTRIBUTE-DECLARED-CURRENT | ATTRIBUTE-DECLARED-CONREF | ATTRIBUTE-DECLARED-DEFAULTED, TO, string primary [269] | ATTRIBUTE-DECLARED-FIXED, TO, string primary [269] | ATTRIBUTE-DECLARED-IMPLIED | ATTRIBUTE-DECLARED-REQUIRED | shelf item reference [448] | value function call [398] | "(", expression [234], ")")

[357] attribute value declaration primary [241] [355] ::= (ATTRIBUTE-DECLARED-CDATA | ATTRIBUTE-DECLARED-ENTITY | ATTRIBUTE-DECLARED-ENTITIES | ATTRIBUTE-DECLARED-GROUP, shelf reference [449] | 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 [353] | shelf item reference [448] | value function call [398] | "(", expression [234], ")")

[358] attribute primary [241] ::=
qualified attribute part identifier [68]
| CREATE-SPECIFIED-ATTRIBUTE, attribute declaration primary [355], FROM, string primary [269]
| CREATE-UNSPECIFIED-ATTRIBUTE, attribute declaration primary [355]
| shelf item reference [448]
| value function call [398]
| "(", expression [234], ")"

13.7 Stream Expressions

[359] stream expression ::= shelf item reference [448]

13.8 Markup Sink Expressions

[360] markup sink expression [361] ::= expression [234]

[361] markup sink primary [241] ::=
built-in markup sink name [362]
| value function call [398]
| "(", markup sink expression [360], ")"

[362] built-in markup sink name [361] ::= #SUPPRESS

13.9 Markup Source Expressions

[363] markup source expression [223] [364] ::= expression [234]

[364] markup source primary [241] ::=
built-in markup source name [38]
| value function call [398]
| "(", markup source expression [363], ")"

13.10 String Source Expressions

[365] string source expression [177] [189] [206] [233] [366] ::= expression [234]

[366] string source primary [241] ::=
built-in string source name [301]
| value function call [398]
| "(", string source expression [365], ")"

13.11 String Sink Expressions

[367] string sink expression [178] [200] ::= expression [234]

[368] string sink primary [185] [241] ::=
shelf item reference [448], modifier expression [427]?
| string sink literal [370], modifier expression [427]?

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

[369] string sink literal for open [176] [182] [370] ::=
string sink literal [370]
| BUFFER

[370] string sink literal [368] [369] ::=
FILE, string primary [269]
| REFERENT, string primary [269]
| THIS, REFERENT
| value function call [398]

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

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


14 Functions

14.1 Function Definition

[371] function definition [116] ::=
external prefix function definition [372]
| external infix function definition [373]
| external conversion function definition [374]
| internal prefix function definition [375]
| internal infix function definition [376]
| internal conversion function definition [377]

[372] external prefix function definition [371] [392] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, shelf class [390]?, type [130]?, prefix function signature definition [379], external function binding [396]

[373] external infix function definition [371] [392] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, type [130], infix function signature definition [380], external function binding [396]

[374] external conversion function definition [371] [392] ::= (DEFINE | EXPORT), EXTERNAL, type [130], conversion function signature definition [381], external function binding [396]

[375] internal prefix function definition [371] [392] ::= (DEFINE | EXPORT), function categorization kind [378]?, shelf class [390]?, type [130]?, prefix function signature definition [379], internal function binding [397]

[376] internal infix function definition [371] [392] ::= (DEFINE | EXPORT), OVERLOADED?, type [130], infix function signature definition [380], internal function binding [397]

[377] internal conversion function definition [371] [392] ::= (DEFINE | EXPORT), type [130], conversion function signature definition [381], internal function binding [397]

[378] function categorization kind [375] ::=
DYNAMIC?, OVERLOADED
| OVERRIDING

[379] prefix function signature definition [372] [375] ::= FUNCTION, prefix function name [472], function argument list definition [384]?

[380] infix function signature definition [373] [376] ::= INFIX-FUNCTION, VALUE, type [130], name [468], infix function name [471], VALUE, type [130], name [468]

[381] conversion function signature definition [374] [377] ::= CONVERSION-FUNCTION, function argument definition [387]

[382] function name [383] [407] ::= name [468]

[383] require function definition [116] ::= REQUIRE, type [130]?, FUNCTION, function name [382], function argument list definition [384]?

[384] function argument list definition [379] [383] ::=
parenthesized function argument list definition [385]
| unparenthesized function argument list definition [386]

[385] parenthesized function argument list definition [384] ::=
"(", ")"
| "(", function argument definition [387], (argument separator [394], function argument definition [387])*, (argument separator [394], remainder argument definition [391], (argument separator [394], ".", ".", ".")?, ")")?
| "(", remainder argument definition [391], argument separator [394], ".", ".", ".", ")"

[386] unparenthesized function argument list definition [384] ::=
argument herald [395]?, function argument definition [387], (argument herald [395], function argument definition [387])*, (argument herald [395], remainder argument definition [391], (argument herald [395], ".", ".", ".")?)?
| argument herald [395], remainder argument definition [391], (argument herald [395], ".", ".", ".")?
| remainder argument definition [391], argument herald [395], ".", ".", "."

[387] function argument definition [381] [385] [386] ::=
expression argument definition [388]
| shelf class argument definition [389]
| converting argument definition [392]

[388] expression argument definition [387] [415] ::= VALUE, type [130], name [468], (OPTIONAL, (INITIAL, "{", expression [234], "}")?)?

[389] shelf class argument definition [387] [415] ::= shelf class [390], first-class type [131], name [468], (OPTIONAL, (INITIAL, shelf literal [446])?)?

[390] shelf class [372] [375] [389] [449] ::=
MODIFIABLE
| READ-ONLY
| WRITE-ONLY

[391] remainder argument definition [385] [386] ::= REMAINDER, first-class type [131], name [468]

[392] converting argument definition [387] ::= VALUE, "(", (ANY | source type name [393], ((OR | "|"), source type name [393])*), INTO, first-class type [131], ")", name [468]

A converting argument definition [392] is only allowed as the first argument of an OVERLOADED external prefix function definition [372] or internal prefix function definition [375], as an argument of an OVERLOADED external infix function definition [373] or internal infix function definition [376], or as the argument of an external conversion function definition [374] or internal conversion function definition [377].

[393] source type name [392] ::=
type [130]
| NUMERIC-LITERAL

[394] argument separator [385] [400] [413] [423] ::=
argument herald [395]
| ","

[395] argument herald [386] [394] [401] [402] [414] [424] ::= name [468]

[396] external function binding [372] [373] [374] ::= AS, system-specific function name [480], (IN, FUNCTION-LIBRARY, system-specific library name [481])?

[397] internal function binding [375] [376] [377] ::=
AS, local scope [151]
| ELSEWHERE

14.2 Function Invocation

[398] value function call [146] [241] [251] [269] [322] [335] [350] [351] [352] [353] [354] [356] [357] [358] [361] [364] [366] [370] [449] ::=
prefix function name [472], parenthesized call arguments [400]
| prefix function name [472], unparenthesized call arguments [401]

[399] void function call [156] [233] ::=
prefix function name [472], parenthesized call arguments [400]
| prefix function name [472], void unparenthesized call arguments [402]

[400] parenthesized call arguments [398] [399] [425] ::= "(", (argument expression [403], (argument separator [394], argument expression [403])*)?, ")"

[401] unparenthesized call arguments [398] [425] ::= (argument herald [395]?, argument primary [404], (argument herald [395], argument primary [404])*)?

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

[403] argument expression [400] [402] ::= expression [234]

[404] argument primary [145] [240] [250] [401] ::= expression primary [241]

14.3 External Function Associations

[405] set external function association action [156] ::=
SET, external function identification [407], TO, system-specific function name [480]
| SET, FUNCTION-LIBRARY, OF, external function identification [407], TO, system-specific library name [481]

[406] external function association enquiry [269] ::= (FUNCTION-LIBRARY, OF)?, external function identification [407]

[407] external function identification [405] [406] ::=
(EXTERNAL-FUNCTION | EXTERNAL-OUTPUT-FUNCTION), function name [382]
| CREATOR, OF, user-defined type name [143]

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

14.4 Function Argument Tests

[408] argument test primary [322] ::= shelf reference [449], (IS | ISNT), SPECIFIED


15 Catch and Throw

15.1 Catch Definitions

[409] catch definition [116] ::= (DECLARE | EXPORT | REQUIRE), catch signature [410]

[410] catch signature [409] ::= CATCH, catch name [411], catch argument list definition [412]?

[411] catch name [410] [422] [425] [426] ::= name [468]

[412] catch argument list definition [410] ::=
parenthesized catch argument list definition [413]
| unparenthesized catch argument list definition [414]

[413] parenthesized catch argument list definition [412] ::=
"(", ")"
| "(", catch argument definition [415], (argument separator [394], catch argument definition [415])*, ")"

[414] unparenthesized catch argument list definition [412] ::= argument herald [395]?, catch argument definition [415], (argument herald [395], catch argument definition [415])*

[415] catch argument definition [413] [414] ::=
expression argument definition [388]
| shelf class argument definition [389]

15.2 Throws

[416] built-in catch invocation [153] ::=
external-exception invocation [417]
| program-error invocation [418]
| markup-start invocation [419]
| markup-end invocation [420]
| markup-point invocation [421]

[417] external-exception invocation [416] ::= #EXTERNAL-EXCEPTION, (IDENTITY, name [468])?, (MESSAGE, name [468])?, (LOCATION, name [468])?

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

[418] program-error invocation [416] ::= #PROGRAM-ERROR, (CODE, name [468])?, (MESSAGE, name [468])?, (LOCATION, name [468])?

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

[419] markup-start invocation [416] ::= #MARKUP-START, name [468]

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

[420] markup-end invocation [416] ::= #MARKUP-END, name [468]

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

[421] markup-point invocation [416] ::= #MARKUP-POINT, name [468]

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

[422] catch invocation [153] ::=
catch name [411], parenthesized invocation arguments [423]
| catch name [411], unparenthesized invocation arguments [424]

[423] parenthesized invocation arguments [422] ::= "(", (name [468], (argument separator [394], name [468])*)?, ")"

[424] unparenthesized invocation arguments [422] ::= (argument herald [395]?, name [468], (argument herald [395], name [468])*)?

[425] throw invocation [193] ::=
catch name [411], parenthesized call arguments [400]
| catch name [411], unparenthesized call arguments [401]
| #MARKUP-START, markup event primary [350]
| #MARKUP-END, markup event primary [350]
| #MARKUP-POINT, markup event primary [350]

15.3 Catch Tests

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


16 Stream Modifiers

[427] modifier expression [176] [182] [185] [368] ::=
WITH, modifier literal [429], (WITH, modifier literal [429])*
| WITH, modifier subexpression [428]

[428] modifier subexpression [427] ::= "(", modifier literal [429], ((AND | "&"), modifier literal [429])*, ")"

[429] modifier literal [427] [428] ::= modifier literal for open [430]

[430] modifier literal for open [429] ::=
modifier literal for set [431]
| BINARY-MODE
| BUFFERED
| TEXT-MODE
| UNBUFFERED

[431] modifier literal for set [185] [430] ::=
modifier literal for reopen [432]
| APPEND

[432] modifier literal for reopen [182] [431] ::=
modifier literal for content [433]
| modifier literal for referents [434]
| modifier literal for break-width [435]

[433] modifier literal for content [368] [432] ::=
constant string literal [282]
| BINARY, numeric subexpression [243]
| DOMAIN-FREE

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

[434] modifier literal for referents [114] [432] ::=
REFERENTS-ALLOWED, (DEFAULTING, "{", string expression [264], (",", string expression [264])?, "}")?
| REFERENTS-DISPLAYED
| REFERENTS-NOT-ALLOWED

[435] modifier literal for break-width [432] ::= BREAK-WIDTH, numeric subexpression [243], (number [254] | TO, numeric subexpression [243])?


17 Shelves

17.1 Shelf Definitions

[436] global shelf definition [116] ::= EXPORT?, global shelf class [438], shelf declaration [443], ((AND | "&"), shelf declaration [443])*

[437] require shelf definition [116] ::= REQUIRE, global shelf class [438], first-class type [131], shelf name [453]

[438] global shelf class [436] [437] ::=
CONSTANT
| DOMAIN-BOUND?, GLOBAL

[439] local declaration [151] ::=
global shelf save declaration [440]
| groups save declaration [441]
| local shelf declaration [442]

[440] global shelf save declaration [439] ::= (SAVE | SAVE-CLEAR), shelf name [453], ((AND | "&"), shelf name [453])*

[441] groups save declaration [439] ::= SAVE, GROUPS

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

[443] shelf declaration [140] [436] [442] [447] ::= first-class type [131], shelf alias [452], (fixed-size shelf declaration [445] | variable-size shelf declaration [444])?, (INITIAL, shelf literal [446])?

[444] variable-size shelf declaration [443] ::= VARIABLE, (TO, constant numeric expression [256])?, (INITIAL-SIZE, constant numeric expression [256])?

[445] fixed-size shelf declaration [443] ::= SIZE, constant numeric expression [256]

[446] shelf literal [202] [218] [389] [443] [447] [449] ::= "{", shelf literal item [447], (",", shelf literal item [447])*, "}"

[447] shelf literal item [446] ::= (expression [234] | UNATTACHED), (WITH, KEY, expression [234])?

When a shelf literal [446] appears in a shelf declaration [443], the number of initializers in expression [234] must match the declared size of the shelf, if any.

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

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

17.2 Shelf References

[448] shelf item reference [147] [157] [160] [164] [165] [166] [169] [171] [176] [179] [180] [181] [182] [183] [186] [193] [202] [241] [251] [252] [269] [271] [289] [305] [307] [311] [316] [318] [319] [322] [350] [351] [352] [353] [354] [356] [357] [358] [359] [368] ::=
shelf reference [449], indexer [455]?
| NEW, new shelf item reference [450]
| NEW, "?", guarded new shelf item reference [451]

[449] shelf reference [159] [162] [163] [218] [253] [350] [353] [357] [408] [448] [450] [451] [459] ::=
shelf name [453]
| shelf literal [446]
| record field reference [142]
| value function call [398]
| ELEMENTS, ancestry qualifier [40]
| CURRENT, ELEMENTS, ancestry qualifier [40]?

When value function call [398] is used as a shelf reference [449], the function definition must have specified a shelf class [390].

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

[450] new shelf item reference [173] [448] ::= shelf reference [449], key indexer [457]?, ((AFTER | BEFORE), indexer [455])?

[451] guarded new shelf item reference [173] [448] ::= shelf reference [449], key indexer [457]

[452] shelf alias [202] [210] [213] [218] [443] ::= name [468]

[453] shelf name [437] [440] [449] ::=
name [468]
| built-in shelf name [454]

[454] built-in shelf name [453] ::=
built-in read-only dtd shelf name [37]
| built-in read-only numeric shelf name [263]
| built-in read-only markup-event shelf name [39]
| built-in read-only stream shelf name [299]
| built-in read-write stream shelf name [300]
| built-in write-only stream shelf name [298]
| built-in read-only switch shelf name [329]

[455] indexer [68] [69] [201] [270] [448] [450] ::=
item indexer [456]
| key indexer [457]
| lastmost indexer [458]

[456] item indexer [68] [271] [455] [459] ::= "[", numeric expression [242], "]"

[457] key indexer [230] [232] [252] [450] [451] [455] ::= "{", string expression [264], "}"

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

17.3 Shelf Tests

[459] shelf test primary [322] ::=
shelf reference [449], item indexer [456]?, (IS | ISNT), KEYED
| shelf reference [449], (HAS | HASNT), KEY, string primary [269]
| REFERENTS, (HAS | HASNT), KEY, string primary [269]


18 Macros

[460] macro definition [115] ::= MACRO, macro name [461], parameter template [462]*, IS, replacement template item [467]*, MACRO-END

[461] macro name [460] ::= macro token [464]+

[462] parameter template [460] ::=
ARG, macro parameter [463], macro token [464]+
| TOKEN, macro parameter [463], macro token [464]*

[463] macro parameter [462] [464] [467] ::=
delimiter token [465]
| name [468]

[464] macro token [461] [462] ::= LITERAL?, macro parameter [463]

[465] delimiter token [463] [467] ::=
infix function name [471]
| delimiter character [466]

[466] delimiter character [465] ::= "(" | ")" | "{" | "}" | "[" | "]" | "`" | ":" | "."

[467] replacement template item [460] ::=
macro parameter [463]
| LITERAL?, string literal [273]
| LITERAL?, delimiter token [465]
| LITERAL?, name [468]
| LITERAL?, number [254]


19 Lexeme Productions

[468] name [36] [53] [96] [100] [101] [102] [103] [104] [142] [143] [313] [337] [380] [382] [388] [389] [391] [392] [395] [411] [417] [418] [419] [420] [421] [423] [424] [452] [453] [463] [467] [471] [472] ::= letter [469], (digit [470] | letter [469] | user-defined name character [482] | "." | "-" | "_")* | "#", constant string literal [282]

[469] letter [468] ::= "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"

[470] digit [255] [468] ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

[471] infix function name [380] [465] [476] ::= infix function start character [473], function following character [475]* | name [468]

[472] prefix function name [379] [398] [399] ::= prefix function start character [474], function following character [475]* | name [468]

[473] infix function start character [471] ::= function following character [475] | prefix function start character [474]

[474] prefix function start character [472] [473] ::= "!" | "-" | "+" | "%" | "?" | "/" | "~" | "$" | "\" | "@" | "^" | ","

[475] function following character [471] [472] [473] ::= "*" | "=" | "|" | "<" | ">" | "&"


20 Dynamically-Defined Lexical Tokens

[476] user-defined infix function name [145] [240] [250] ::= Any infix function name [471] defined in a program rather than by OmniMark, and which are not overloadings of operators defined by OmniMark to be overloadable.

[477] escape [286] [287] [288] [305] [306] [307] [308] [309] [310] [311] [312] [313] [314] [315] [316] [317] [318] [319] [478] ::= The escape [477] character is defined by an escape declaration [111]. If there is no escape declaration [111], the escape character is "%".

[478] unescaped character [275] [276] [284] [285] ::= An unescaped character [478] is any character that is not a "'", a """, a control character, or escape [477].

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

[480] system-specific function name [135] [396] [405] ::= A system-specific function name [480] is implemented as a constant string expression [277].

[481] system-specific library name [135] [396] [405] ::= A system-specific library name [481] is implemented as a constant string expression [277].

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

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

Copyright © Stilo Corporation, 2003-2016. All rights reserved.
ETR62, 2016/4/1