Grammar for OmniMark 11.0

Table of Contents

Index of Productions

Notices

1 Program

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

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

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

[4] program body [2] [3] ::= declaration [108]*, (unrestricted declaration [109] | group member [94] | identified group [92])*


2 Main Process Rules

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

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

[7] process rule [5] ::= PROCESS, condition [323]?, local scope [154]

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


3 Markup Processing Rules

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

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

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

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

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

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

[15] document type definition rule [9] ::= DOCUMENT-TYPE-DECLARATION, condition [323]?, local scope [154]

[16] element rule [9] ::= ELEMENT, (element rule name set [32] | #IMPLIED), condition [323]?, local scope [154]

[17] epilog start rule [9] ::= EPILOG-START, condition [323]?, local scope [154]

[18] external data entity rule [9] ::= (EXTERNAL-DATA-ENTITY | EXTERNAL-ENTITY), (markup name set [36] | #IMPLIED), condition [323]?, local scope [154]

[19] invalid data rule [9] ::= INVALID-DATA, condition [323]?, local scope [154]

[20] marked section rule [9] ::= MARKED-SECTION, marked section type [30], condition [323]?, local scope [154]

[21] sgml comment processing rule [9] ::= (MARKUP-COMMENT | SGML-COMMENT), condition [323]?, local scope [154]

[22] markup error rule [95] ::= (MARKUP-ERROR | SGML-ERROR), condition [323]?, LOG?, local scope [154]

[23] processing instruction rule [9] ::= PROCESSING-INSTRUCTION, processing instruction matcher [29], condition [323]?, local scope [154]

[24] prolog end rule [9] ::= PROLOG-END, condition [323]?, local scope [154]

[25] prolog in error rule [9] ::= PROLOG-IN-ERROR, condition [323]?, local scope [154]

[26] sgml declaration end rule [9] ::= SGML-DECLARATION-END, condition [323]?, local scope [154]

[27] translation rule [9] ::= TRANSLATE, pattern expression [334], condition [323]?, local scope [154]

[28] xmlns-change rule [9] ::= XMLNS-CHANGE, condition [323]?, local scope [154]

[29] processing instruction matcher [23] ::=
pattern expression [334]
| NAMED, pattern expression [334], (VALUED, pattern expression [334])?
| VALUED, pattern expression [334], (NAMED, pattern expression [334])?

[30] marked section type [20] ::=
INCLUDE-START
| INCLUDE-END
| RCDATA
| CDATA
| IGNORE

3.1 Markup Names

[31] element name set [44] [46] [48] ::=
qualified element name [34]
| "(", qualified element name [34], ((OR | "|"), qualified element name [34])*, ")"

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

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

[34] qualified element name [31] [52] ::= (#BASE | #FULL | #XMLNS)?, element name [35]

[35] element name [33] [34] ::=
markup name [37]
| "~", string primary [272]

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

[36] markup name set [18] [68] ::=
markup name [37]
| "(", markup name [37], ((OR | "|"), markup name [37])*, ")"

[37] markup name [35] [36] [43] [47] [54] [75] [76] [90] ::=
constant string literal [285]
| name [479]

[38] built-in read-only dtd shelf name [358] [465] ::=
#CURRENT-DTD
| SGML-DTDS
| XML-DTDS

[39] built-in markup source name [371] ::= #CONTENT

[40] built-in read-only markup-event shelf name [357] [465] ::= #CURRENT-MARKUP-EVENT

3.2 Elements

[41] ancestry qualifier [35] [48] [72] [73] [199] [254] [272] [460] ::= OF, ancestry expression [42]

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

[43] ancestry secondary [42] [47] ::=
ancestry primary [44], (OF, ancestry secondary [43])?
| markup event primary [357]
| CURRENT, ELEMENT, markup name [37]

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

3.2.1 Element Tests

[45] element test primary [326] ::=
element identity test primary [46]
| element property test primary [48]

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

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

[48] element property test primary [45] ::=
CONTENT, ancestry qualifier [41]?, (IS | ISNT), content type set [49]
| LAST, PROPER?, CONTENT, ancestry qualifier [41]?, (IS | ISNT), element name or data set [51]
| LAST, PROPER?, SUBELEMENT, ancestry qualifier [41]?, (IS | ISNT), element name set [31]
| PREVIOUS, ancestry qualifier [41]?, (IS | ISNT), element name set [31]
| STATUS, (OF, LAST, SUBELEMENT)?, ancestry qualifier [41]?, (IS | ISNT), (PROPER | INCLUSION)
| USEMAP, ancestry qualifier [41]?, (IS | ISNT), short reference map name set [53]

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

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

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

[52] element name or data [51] ::=
qualified element name [34]
| #DATA

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

[54] short reference map name [53] ::=
markup name [37]
| name [479]
| #EMPTY
| #NONE

3.3 Entity and Notation Tests

[55] entity test primary [326] ::=
qualified attribute part identifier [69], (IS | ISNT), entity category set [58]
| ENTITY, (IS | ISNT), entity category set [58]
| notation selector [57], (IS | ISNT), notation category set [60]
| notation selector [57], equivalence comparer [328], notation name set [68]

[56] entity selector [57] ::=
ENTITY
| qualified attribute part identifier [69]

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

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

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

[60] notation category set [55] ::=
notation category [61]
| "(", notation category [61], ((AND | "&"), notation category [61])*, ")"
| "(", notation category [61], ((OR | "|"), notation category [61])*, ")"

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

[62] external identifier type [59] [61] ::=
PUBLIC
| SYSTEM
| IN-LIBRARY

[63] entity type [59] ::=
CDATA-ENTITY
| NDATA-ENTITY
| SDATA-ENTITY
| SUBDOC-ENTITY

[64] entity class [59] ::=
GENERAL
| PARAMETER

[65] default entity type [59] ::= DEFAULT-ENTITY

[66] anonymous entity type [59] [90] [91] ::=
#CAPACITY
| #CHARSET
| #DOCUMENT
| #DTD
| #SCHEMA
| #SYNTAX

[67] entity scope [59] ::=
INTERNAL
| EXTERNAL

[68] notation name set [55] ::= markup name set [36]

3.4 Attributes

[69] qualified attribute part identifier [55] [56] [70] [71] [72] [73] [272] [365] ::=
(simple qualified attribute set identifier [73], indexer [466] | DATA-ATTRIBUTE, attribute name [76], OF, qualified attribute part identifier [69])
| simple qualified attribute identifier [72], item indexer [467]?

[70] qualified attribute identifier [82] [199] [221] [256] [274] ::=
(simple qualified attribute set identifier [73], indexer [466] | DATA-ATTRIBUTE, attribute name [76], OF, qualified attribute part identifier [69])
| simple qualified attribute identifier [72]

[71] qualified attribute set identifier [83] [221] [256] ::=
attribute subset specifier [74]?, DATA-ATTRIBUTES, OF, qualified attribute part identifier [69]
| simple qualified attribute set identifier [73]

[72] simple qualified attribute identifier [69] [70] [199] ::=
ATTRIBUTE, attribute name [76], ancestry qualifier [41]?
| DATA-ATTRIBUTE, attribute name [76], (OF, "(", qualified attribute part identifier [69], ")")?

[73] simple qualified attribute set identifier [69] [70] [71] [255] ::=
attribute subset specifier [74]?, ATTRIBUTES, ancestry qualifier [41]?
| attribute subset specifier [74]?, DATA-ATTRIBUTES, (OF, "(", qualified attribute part identifier [69], ")")?

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

[75] attribute alias [221] ::= markup name [37]

[76] attribute name [69] [70] [72] [199] [309] ::= markup name [37]

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

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

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

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

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

3.4.1 Attribute Tests

[82] attribute test primary [326] ::= qualified attribute identifier [70], (IS | ISNT), attribute type set [77]

[83] attributes test primary [326] ::= qualified attribute set identifier [71], (HAS | HASNT), KEY, string primary [272]


4 Input Processing Rules

[84] input processing rule [95] ::=
find rule [86]
| find end rule [85]
| find start rule [87]
| external text entity rule [89]

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

[86] find rule [84] ::= FIND, NULL?, pattern expression [334], condition [323]?, local scope [154]

[87] find start rule [84] ::= FIND-START, condition [323]?, local scope [154]

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

[89] external text entity rule [84] ::= EXTERNAL-TEXT-ENTITY, (extended entity name set [88] | implied entity type set [91]), condition [323]?, local scope [154]

[90] extended entity name [88] ::=
markup name [37]
| anonymous entity type [66]

[91] implied entity type set [89] ::=
#IMPLIED
| "(", (anonymous entity type [66], (OR | "|"))*, #IMPLIED, ((OR | "|"), anonymous entity type [66])*, ")"


5 Groups

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

[93] group identification [92] ::=
group name set [96]
| #IMPLIED

[94] group member [4] [92] ::=
include [100]
| rule [95]

[95] rule [94] ::=
markup processing rule [9]
| input processing rule [84]
| line breaking rule [130]
| main process rule [5]
| markup error rule [22]

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

[97] group name [96] ::=
constant string literal [285]
| name [479]

[98] current group set [177] [200] ::=
group name set [96]
| (group name set [96], (AND | "&"))?, #GROUP, ((AND | "&"), group name set [96])?
| #IMPLIED


6 Aided-translation Types

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

[100] include [94] ::= INCLUDE, constant string literal [285]

[101] include guard declaration [118] ::= INCLUDE-GUARD, (constant string literal [285] | name [479])

7.2 Modules

[102] module declaration [3] ::=
MODULE, (SHARED, AS, (constant string literal [285] | name [479]))?
| MODULE, INTERFACE, SHARED, AS, (constant string literal [285] | name [479])
| MODULE, IMPLEMENTS, constant string literal [285]

[103] import declaration [118] ::=
IMPORT, constant string literal [285], EXPORT?, PREFIXED, BY, name [479], module parameterization clauses [104]
| IMPORT, constant string literal [285], EXPORT?, UNPREFIXED, module parameterization clauses [104]
| IMPORT, constant string literal [285], ONLY, module parameterization clauses [104]

[104] module parameterization clauses [103] ::= (use clause [105] | supply clause [106])*

[105] use clause [104] ::=
EXPORT?, USE, name [479], (AS, name [479])?
| EXPORT?, USE, #CONVERSION-FUNCTIONS

[106] supply clause [104] ::= SUPPLY, name [479], (AS, name [479])?

7.3 Accessing Text Files

[107] library declaration [118] ::= LIBRARY, (constant string expression [280], constant string expression [280])+


8 Declarations

[108] declaration [4] ::=
naming declaration [122]
| program-level declaration [110]
| unrestricted declaration [109]

[109] unrestricted declaration [4] [108] ::=
common declaration [118]
| global object definition [119]
| global stream declaration [111]

[110] program-level declaration [108] ::=
default io declaration [112]
| escape declaration [113]

[111] global stream declaration [109] ::=
main buffering declaration [114]
| main domain-free declaration [115]
| main mode declaration [116]
| main output referent declaration [117]

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

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

[113] escape declaration [110] [488] ::= ESCAPE, constant string primary [283]

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

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

[115] main domain-free declaration [111] ::= DECLARE, (#MAIN-OUTPUT | #PROCESS-OUTPUT), HAS, DOMAIN-FREE

main domain-free declaration [115] cannot appear in a module.

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

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

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

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

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

[118] common declaration [109] ::=
binary input declaration [120]
| binary output declaration [121]
| break-width declaration [129]
| delimiter declaration [306]
| external function library declaration [153]
| import declaration [103]
| include guard declaration [101]
| library declaration [107]
| macro definition [471]
| markup identification declaration [126]
| symbol declaration [305]

[119] global object definition [109] ::=
catch definition [416]
| function definition [378]
| global shelf definition [444]
| require function definition [390]
| require shelf definition [445]
| user-defined type declaration [136]

[120] binary input declaration [118] ::= BINARY-INPUT, constant numeric expression [259]

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

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

[121] binary output declaration [118] ::= BINARY-OUTPUT, constant numeric expression [259]

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

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

8.1 Naming Declarations

[122] naming declaration [108] ::=
data letters declaration [123]
| entity namecase declaration [124]
| general namecase declaration [125]
| name letters declaration [127]
| newline declaration [128]

[123] data letters declaration [122] ::=
DECLARE, DATA-LETTERS, constant string expression [280], constant string expression [280]?
| LETTERS, constant string expression [280], constant string expression [280]?

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

[124] entity namecase declaration [122] ::= NAMECASE, ENTITY, (YES | NO)

entity namecase declaration [124] is deprecated.

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

general namecase declaration [125] is deprecated.

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

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

[128] newline declaration [122] ::= NEWLINE, constant string expression [280]

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

8.2 Line-breaking Declarations

[129] break-width declaration [118] ::= BREAK-WIDTH, constant numeric expression [259], (number [257] | TO, constant numeric expression [259])?

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

[130] line breaking rule [95] ::=
insertion break rule [131]
| replacement break rule [132]

[131] insertion break rule [130] ::= INSERTION-BREAK, constant string expression [280], condition [323]?

[132] replacement break rule [130] ::= REPLACEMENT-BREAK, constant string primary [283], constant string expression [280], condition [323]?


9 Types

[133] type [379] [380] [381] [382] [383] [384] [387] [390] [395] [400] ::=
first-class type [134]
| qualified type [135]

[134] first-class type [133] [396] [398] [399] [445] [452] [453] [458] ::=
user-defined type name [146]
| 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.

[135] qualified type [133] ::= (MARKUP | STRING), (SINK | SOURCE)

9.1 User-Defined Types

[136] user-defined type declaration [119] ::=
opaque type declaration [137]
| record type declaration [140]
| user-defined type require [144]

[137] opaque type declaration [136] ::= (DECLARE | EXPORT), (ABSTRACT, OPAQUE, user-defined type name [146], opaque type inheritance clause [139]? | OPAQUE, user-defined type name [146], opaque type inheritance clause [139]?, opaque type declaration binding [138])

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

[138] opaque type declaration binding [137] ::= CREATED, BY, system-specific function name [491], (IN, FUNCTION-LIBRARY, system-specific library name [492])?

[139] opaque type inheritance clause [137] ::= EXTENDS, user-defined type name [146]

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

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

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

[141] record type declaration binding [140] ::=
field declaration [143]*
| ELSEWHERE

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

[142] record type inheritance clause [140] ::= EXTENDS, user-defined type name [146]

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

[143] field declaration [141] ::= FIELD, shelf declaration [453]

[144] user-defined type require [136] ::= REQUIRE, OPAQUE, user-defined type name [146]

[145] record field reference [205] [221] [460] ::= user-defined type instance [150], ":", name [479]

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

[146] user-defined type name [134] [137] [139] [140] [142] [144] [149] [213] [414] ::= name [479]

[147] user-defined type expression [150] [355] ::= expression [237]

[148] user-defined type subexpression [151] ::=
argument primary [411], (user-defined infix function name [487], argument primary [411])+
| user-defined type primary [149]

[149] user-defined type primary [148] ::=
user-defined type name [146], CAST, user-defined type primary [149]
| value function call [405]
| user-defined type instance [150]

[150] user-defined type instance [145] [149] ::=
shelf item reference [459]
| "(", user-defined type expression [147], ")"

[151] user-defined type test primary [326] ::= user-defined type subexpression [148], (reference comparer [152], user-defined type subexpression [148])+

[152] reference comparer [151] ::=
"=="
| "!=="

[153] external function library declaration [118] ::= DECLARE, FUNCTION-LIBRARY, constant string expression [280]


10 Actions

[154] local scope [6] [7] [8] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [85] [86] [87] [89] [206] [207] [209] [210] [213] [214] [215] [220] [223] [224] [226] [227] [333] [404] ::= local declaration [448]*, action [157]*, catch alternative [156]*, always block [155]*

[155] always block [154] ::= ALWAYS, action [157]*

[156] catch alternative [154] ::= CATCH, (built-in catch invocation [423] | catch invocation [429]), action [157]*

[157] action [154] [155] [156] ::= using prefix [198]*, guarded action [158]

[158] guarded action [157] ::= basic action [159], condition [323]?

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

[160] activate action [159] ::= ACTIVATE, shelf item reference [459], ((AND | "&"), shelf item reference [459])*

[161] assert action [159] ::= ASSERT, boolean expression [324], (MESSAGE, expression [237])?

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

[163] close action [159] ::= CLOSE, shelf item reference [459], ((AND | "&"), shelf item reference [459])*

[164] collect garbage action [159] ::= COLLECT-GARBAGE

[165] copy action [159] ::= COPY, shelf reference [460], TO, shelf reference [460]

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

[167] deactivate action [159] ::= DEACTIVATE, shelf item reference [459], ((AND | "&"), shelf item reference [459])*

[168] decrement action [159] ::= DECREMENT, shelf item reference [459], (BY, numeric expression [245])?

[169] discard action [159] ::= DISCARD, shelf item reference [459], ((AND | "&"), shelf item reference [459])*

[170] exit action [159] ::= EXIT

[171] fail action [159] ::= FAIL

[172] flush action [159] ::= FLUSH, shelf item reference [459], ((AND | "&"), shelf item reference [459])*

[173] halt action [159] ::= (HALT | HALT-EVERYTHING), (WITH, numeric expression [245])?

[174] increment action [159] ::= INCREMENT, shelf item reference [459], (BY, numeric expression [245])?

[175] log-message action [159] ::= LOG-MESSAGE, string expression [267]

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

[176] new action [159] ::=
NEW, new shelf item reference [461], ((AND | "&"), new shelf item reference [461])*
| NEW, "?", guarded new shelf item reference [462], ((AND | "&"), guarded new shelf item reference [462])*

[177] next group action [159] ::= NEXT, GROUP, IS, (current group set [98] | "(", current group set [98], ")")

[178] not reached action [159] ::= NOT-REACHED, (MESSAGE, string expression [267])?

[179] open action [159] ::= OPEN, modified shelf item reference [443], AS, string sink literal for open [376], modifier expression [434]?

A modifier expression [434] can only appear on the left-hand side (as part of modified shelf item reference [443]) or the right-hand side, but not both.

[180] output action [159] ::= OUTPUT, string source expression [372]

[181] output to action [159] ::= OUTPUT-TO, string sink expression [374]

[182] put action [159] ::=
PUT, modified shelf item reference [443], ((AND | "&"), modified shelf item reference [443])*, string expression [267]
| PUT, "(", modified shelf item reference [443], ((AND | "&"), modified shelf item reference [443])*, ")", string expression [267]

[183] remove action [159] ::= REMOVE, shelf item reference [459]

[184] remove key action [159] ::= REMOVE, KEY, OF, shelf item reference [459]

[185] reopen action [159] ::= REOPEN, modified shelf item reference [443], (AS, string sink literal for open [376], modifier expression [434]?)?

A modifier expression [434] can only appear on the left-hand side (as part of modified shelf item reference [443] or the right-hand side, but not both.

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

[186] reset action [159] ::= RESET, shelf item reference [459], (TO, numeric expression [245])?

[187] return action [159] ::= RETURN, expression [237]?

[188] set action [159] ::= SET, string sink primary [375], TO, expression [237]

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

[189] set key action [159] ::= SET, KEY, OF, shelf item reference [459], TO, string expression [267]

[190] sgml in action [159] ::= SGML-IN, (string expression [267] | #NONE)

[191] sgml out action [159] ::= SGML-OUT, (string expression [267] | #NONE)

[192] submit action [159] ::= SUBMIT, string source expression [372]

[193] succeed action [159] ::= SUCCEED

[194] suppress action [159] ::= SUPPRESS

[195] test system action [159] ::= TEST-SYSTEM, (WITH, string expression [267])?

[196] throw action [159] ::= (SIGNAL, (TO, shelf item reference [459])?)?, (THROW, throw invocation [432] | RETHROW)

[197] void action [159] ::= VOID, expression [237]


11 Using

[198] using prefix [157] ::=
using attribute association prefix [199]
| using group prefix [200]
| using input prefix [201]
| using nested-referents prefix [202]
| using output prefix [203]
| using referents association prefix [204]
| using shelf item association prefix [205]

[199] using attribute association prefix [198] ::= USING, qualified attribute identifier [70], (AS, attribute name [76])?

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

[200] using group prefix [198] ::=
USING, GROUP, current group set [98]
| USING, GROUP, "(", current group set [98], ")"

[201] using input prefix [198] ::= USING, INPUT, AS, string expression [267]

[202] using nested-referents prefix [198] ::= USING, NESTED-REFERENTS

[203] using output prefix [198] ::= USING, OUTPUT, AS, string sink expression [374]

[204] using referents association prefix [198] ::= USING, REFERENTS, indexer [466]

[205] using shelf item association prefix [198] ::= USING, shelf item reference [459], (AS, shelf alias [463])?

If shelf item reference [459] contains a shelf literal [457] or a record field reference [145], the shelf alias [463] is required.


12 Block Constructs

[206] do action [159] ::= DO, local scope [154], DONE

[207] do conditional action [159] ::= DO, condition [323], local scope [154], (ELSE, condition [323], local scope [154])*, (ELSE, local scope [154], DONE)?

[208] do markup parse action [159] ::=
do generic parse action [226]
| do sgml parse action [224]
| do xml parse action [227]

[209] do scan action [159] ::= DO, SCAN, string source expression [372], match alternative [223]+, (ELSE, local scope [154])?, DONE

[210] do select action [159] ::= DO, SELECT, numeric expression [245], AS, shelf alias [463], (CASE, constant numeric range set [211], local scope [154])+, (ELSE, local scope [154])?, DONE

[211] constant numeric range set [210] ::=
constant numeric range [212], ((OR | "|"), constant numeric range [212])*
| "(", constant numeric range [212], ((OR | "|"), constant numeric range [212])*, ")"

[212] constant numeric range [211] ::= constant numeric expression [259], (TO, constant numeric expression [259])?

[213] do select-type action [159] ::= DO, SELECT-TYPE, hierarchical type expression [355], AS, shelf alias [463], (CASE, user-defined type name [146], local scope [154])+, (ELSE, local scope [154])?, DONE

[214] do skip action [159] ::= DO, SKIP, (OVER, pattern expression [334] | PAST, numeric expression [245], (OVER, pattern expression [334])?), local scope [154], (ELSE, local scope [154])?, DONE

[215] repeat action [159] [219] ::= REPEAT, for part [216]?, from part [217]?, to part [218]?, by part [219]?, local scope [154], AGAIN

[216] for part [215] [219] ::= FOR, INTEGER, shelf alias [463]

[217] from part [215] [219] ::= FROM, numeric expression [245]

[218] to part [215] [219] ::= TO, numeric expression [245]

[219] by part [215] ::= BY, numeric expression [245]

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

[220] repeat over action [159] [333] ::= REPEAT, OVER, repeat over component [221], ((AND | "&"), repeat over component [221])*, local scope [154], AGAIN

[221] repeat over component [220] ::=
qualified attribute identifier [70], (AS, attribute alias [75])?
| qualified attribute set identifier [71], AS, attribute alias [75]
| REVERSED?, shelf reference [460], (AS, shelf alias [463])?
| REFERENTS

If shelf reference [460] is a shelf literal [457], a record field reference [145], or a reference to CURRENT ELEMENTS, the shelf alias [463] is required.

[222] repeat scan action [159] ::= REPEAT, SCAN, string expression [267], match alternative [223]+, AGAIN

[223] match alternative [209] [222] ::= MATCH, UNANCHORED?, NULL?, pattern expression [334], condition [323]?, local scope [154]

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

12.1 Markup Parse Actions

[224] do sgml parse action [208] ::= DO, SGML-PARSE, sgml parse type [225], SCAN, markup parse scanning source [236], local scope [154], DONE

[225] sgml parse type [224] ::=
(DOCUMENT | SUBDOCUMENT), id checking specifier [229]?, utf8 specifier [231]?, (CREATING, sgml dtd shelf item [233])?
| INSTANCE, instance element specifier [230]?, sgml dtd specifier [232], id checking specifier [229]?, utf8 specifier [231]?

[226] do generic parse action [208] ::= DO, MARKUP-PARSE, markup source expression [370], local scope [154], DONE

[227] do xml parse action [208] ::= DO, XML-PARSE, xml parse type [228]?, SCAN, markup parse scanning source [236], local scope [154], DONE

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

[228] xml parse type [227] ::=
DOCUMENT, id checking specifier [229]?, utf8 specifier [231]?, (CREATING, xml dtd shelf item [235])?
| INSTANCE, (instance element specifier [230]?, xml dtd specifier [234])?, id checking specifier [229]?, utf8 specifier [231]?

[229] id checking specifier [225] [228] ::= WITH, ID-CHECKING, boolean expression [324]

[230] instance element specifier [225] [228] ::= WITH, DOCUMENT-ELEMENT, string expression [267]

[231] utf8 specifier [225] [228] ::= WITH, UTF-8, boolean expression [324]

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

[233] sgml dtd shelf item [225] [232] ::= (DTDS | SGML-DTDS), key indexer [468]

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

[235] xml dtd shelf item [228] [234] ::= XML-DTDS, key indexer [468]

12.1.1 Markup Parse Support

[236] markup parse scanning source [224] [227] ::=
INPUT, void function call [406]
| string source expression [372]

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


13 Expressions

[237] expression [147] [161] [187] [188] [197] [244] [245] [267] [324] [356] [358] [359] [360] [361] [363] [364] [365] [367] [370] [372] [374] [395] [410] [458] ::= conditional expression [238], ((OR | "|"), conditional expression [238])*

[238] conditional expression [237] ::=
conjunctive expression [239], "->", conditional expression [238], "|", conditional expression [238]
| conjunctive expression [239]

[239] conjunctive expression [238] ::= factor expression [240], ((AND | "&"), factor expression [240])*

[240] factor expression [239] ::= (NOT | "!")?, comparison expression [241]

[241] comparison expression [240] ::= subexpression [242], ((equality comparer [329], subexpression [242])+ | inequality comparer [330], subexpression [242])?

[242] subexpression [241] [246] [268] ::=
numeric term [248], (numeric additive operator [247], numeric term [248])*
| string term [269], ((JOIN | "||"), string term [269])*
| expression secondary [243]

[243] expression secondary [242] [271] ::= expression primary [244], (user-defined infix function name [487], argument primary [411])+

[244] expression primary [243] [411] ::=
ancestry expression [42]
| attribute declaration primary [362]
| attribute default declaration primary [363]
| attribute value declaration primary [364]
| attribute primary [365]
| boolean primary [326]
| content model primary [361]
| dtd primary [358]
| element declaration primary [360]
| entity declaration primary [359]
| markup event primary [357]
| markup sink primary [368]
| markup source primary [371]
| numeric primary [254]
| string primary [272]
| string sink primary [375]
| string source primary [373]
| shelf item reference [459]
| value function call [405]
| "(", expression [237], ")"

13.1 Numeric Expressions

[245] numeric expression [168] [173] [174] [186] [210] [214] [217] [218] [219] [254] [347] [467] ::= expression [237]

[246] numeric subexpression [265] [269] [270] [440] [442] ::= subexpression [242]

[247] numeric additive operator [242] [259] ::=
PLUS
| "+"
| MINUS
| "-"
| UNION
| DIFFERENCE

[248] numeric term [242] ::= numeric factor [250], (numeric multiplicative operator [249], numeric factor [250])*

[249] numeric multiplicative operator [248] [260] ::=
TIMES
| "*"
| DIVIDE
| "/"
| MODULO
| MASK
| SHIFT

[250] numeric factor [248] ::= numeric tertiary [251], ("**", numeric factor [250])?

[251] numeric tertiary [250] ::=
numeric secondary [253]
| string secondary [271], (numeric conversion operator [252], numeric secondary [253])?

[252] numeric conversion operator [251] [262] ::=
BASE
| BINARY

[253] numeric secondary [251] ::=
argument primary [411], (user-defined infix function name [487], argument primary [411])+
| numeric primary [254]

[254] numeric primary [244] [253] ::=
value function call [405]
| string primary [272]
| "+", numeric primary [254]
| (NEGATE | "-"), numeric primary [254]
| COMPLEMENT, numeric primary [254]
| shelf item reference [459]
| BINARY, string primary [272]
| CHILDREN, ancestry qualifier [41]?
| ITEM, OF, item-of reference [255]
| LENGTH, OF, string primary [272]
| (NUMBER, OF | NUMBER-OF), number-of reference [256]
| OCCURRENCE, ancestry qualifier [41]?
| SYSTEM-CALL, string primary [272]
| number [257]
| "(", numeric expression [245], ")"

[255] item-of reference [254] ::=
shelf item reference [459]
| simple qualified attribute set identifier [73], key indexer [468]
| REFERENTS, key indexer [468]
| THIS, REFERENT

[256] number-of reference [254] ::=
qualified attribute identifier [70]
| qualified attribute set identifier [71]
| shelf reference [460]
| CURRENT, SUBDOCUMENTS
| REFERENTS

[257] number [129] [254] [263] [290] [291] [308] [309] [310] [313] [314] [318] [319] [321] [322] [442] [478] [490] ::= natural number [258], (".", natural number [258])?

[258] natural number [257] ::= digit [481]+, ("_", digit [481]+)*

13.1.1 Constant Numeric Expressions

[259] constant numeric expression [120] [121] [129] [212] [263] [282] [454] [455] [456] ::= constant numeric term [260], (numeric additive operator [247], constant numeric term [260])*

[260] constant numeric term [259] ::= constant numeric factor [261], (numeric multiplicative operator [249], constant numeric factor [261])*

[261] constant numeric factor [260] ::= constant numeric secondary [262], ("**", constant numeric factor [261])?

[262] constant numeric secondary [261] ::=
constant numeric primary [263]
| constant string primary [283], numeric conversion operator [252], constant numeric primary [263]

[263] constant numeric primary [262] [281] ::=
constant string primary [283]
| (NEGATE | "-"), constant numeric primary [263]
| COMPLEMENT, constant numeric primary [263]
| BINARY, constant string primary [283]
| LENGTH, OF, constant string primary [283]
| number [257]
| "(", constant numeric expression [259], ")"

13.1.2 Numeric Tests

[264] numeric test primary [326] ::= VALUE?, numeric comparison [265]

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

[265] numeric comparison [264] ::= numeric subexpression [246], (comparer [327], numeric subexpression [246])+

13.1.3 Built-In Numeric Shelves

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

[267] string expression [175] [178] [182] [189] [190] [191] [195] [201] [222] [230] [272] [296] [441] [468] ::= expression [237]

[268] string subexpression [296] [297] ::= subexpression [242]

[269] string term [242] ::=
string factor [270], ((REPEATED | "||*"), numeric subexpression [246])*
| string factor [270], TAKE, UNANCHORED?, pattern secondary [339]
| string factor [270], DROP, UNANCHORED?, pattern secondary [339]

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

[270] string factor [269] ::= string secondary [271], ((FORMAT | "%"), numeric subexpression [246])*

[271] string secondary [251] [270] ::=
expression secondary [243]
| string primary [272]

[272] string primary [35] [83] [244] [254] [271] [273] [298] [340] [357] [360] [363] [365] [377] [470] ::=
stream input/output mode [275]?, value function call [405]
| constant string value [284]
| external function association enquiry [413]
| pattern name [344]
| qualified attribute part identifier [69]
| referent item reference [273]
| shelf item reference [459]
| stream input/output mode [275]?, FILE, string primary [272]
| DATE, string primary [272]
| KEY, OF, key-of reference [274]
| NAME, OF, shelf item reference [459]
| NAME, OF, element declaration primary [360]
| NAME, ancestry qualifier [41]
| NAME, OF, ENTITY
| PUBLIC-IDENTIFIER, OF, ENTITY
| SYSTEM-IDENTIFIER, OF, ENTITY
| XMLNS-NAME, ancestry qualifier [41]?
| "~", string primary [272]
| string literal [276]
| "(", string expression [267], ")"

[273] referent item reference [272] [377] ::=
REFERENTS, indexer [466]
| THIS, REFERENT
| REFERENT, string primary [272]
| SILENT-REFERENT, string primary [272]

[274] key-of reference [272] ::=
qualified attribute identifier [70]
| shelf item reference [459]
| REFERENTS, item indexer [467]
| THIS, REFERENT

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

13.2.1 String Literals

[276] string literal [272] [340] [478] ::= string literal part [277], ("_", string literal part [277])*

[277] string literal part [276] ::=
double-quoted string literal part [278]
| single-quoted string literal part [279]

[278] double-quoted string literal part [277] ::= """, (described character [290] | described substring [291] | escaped text [289] | format item [307] | unescaped character [489] | "'")*, """

[279] single-quoted string literal part [277] ::= "'", (described character [290] | described substring [291] | escaped text [289] | format item [307] | unescaped character [489] | """)*, "'"

13.2.2 Constant String Expressions

[280] constant string expression [107] [123] [127] [128] [131] [132] [153] [283] [305] [306] [491] [492] ::= constant string term [281], ((JOIN | "||"), constant string term [281])*

[281] constant string term [280] ::= constant string factor [282], ((REPEATED | "||*"), constant numeric primary [263])?

[282] constant string factor [281] ::= constant string primary [283], ((FORMAT | "%"), (constant numeric expression [259] | constant string primary [283]))*

[283] constant string primary [113] [132] [262] [263] [282] [284] ::=
constant string value [284]
| constant string literal [285]
| "(", constant string expression [280], ")"

[284] constant string value [272] [283] ::= COMPILED-DATE, constant string primary [283]

[285] constant string literal [37] [97] [100] [101] [102] [103] [283] [352] [440] [479] ::= constant string literal part [286], ("_", constant string literal part [286])*

[286] constant string literal part [285] ::=
double-quoted constant string literal part [287]
| single-quoted constant string literal part [288]

[287] double-quoted constant string literal part [286] ::= """, (described character [290] | described substring [291] | escaped text [289] | unescaped character [489] | "'")*, """

[288] single-quoted constant string literal part [286] ::= "'", (described character [290] | described substring [291] | escaped text [289] | unescaped character [489] | """)*, "'"

[289] escaped text [278] [279] [287] [288] ::= escape [488], (escape [488] | """ | "'" | "#" | ")")

[290] described character [278] [279] [287] [288] ::=
escape [488], "_"
| escape [488], "n"
| escape [488], "t"
| escape [488], number [257], "#"

[291] described substring [278] [279] [287] [288] [490] ::= escape [488], number [257], "r", "{", describing number [490], (",", describing number [490])*, "}"

13.2.3 Stream Tests

[292] stream test primary [326] ::=
shelf item reference [459], (HAS | HASNT), NAME
| shelf item reference [459], (IS | ISNT), stream type set [293]
| THIS, REFERENT, (IS | ISNT), ATTACHED

[293] stream type set [292] ::=
stream type [294]
| "(", stream type [294], ((AND | "&"), stream type [294])*, ")"
| "(", stream type [294], ((OR | "|"), stream type [294])*, ")"

[294] stream type [293] ::=
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

[295] string test primary [326] ::=
string comparison [296]
| string match test primary [297]

[296] string comparison [295] ::= string subexpression [268], (comparer [327], UL?, string subexpression [268])*, (comparer [327], UL?, (string subexpression [268] | "(", string expression [267], ((OR | "|"), string expression [267])*, ")"))*

[297] string match test primary [295] ::= string subexpression [268], MATCHES, UNANCHORED?, pattern secondary [339]

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

13.2.5 Source Tests

[298] source test primary [326] ::=
FILE, string primary [272], EXISTS
| FILE, string primary [272], (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 [465] ::=
#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.

[302] built-in read-only stream shelf name [465] ::=
#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 [465] ::=
#LIBPATH
| #LIBRARY
| #LIBVALUE

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

13.2.7 Formatting Declarations

[305] symbol declaration [118] ::= SYMBOL, constant string expression [280]+

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

[306] delimiter declaration [118] ::= DELIMITER, constant string expression [280]

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

13.2.8 Format Items

[307] format item [278] [279] ::=
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 [488], (number [257], "f" | "j" | "k" | "l" | "u" | "w")*, "a", "(", shelf item reference [459], ")"

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

[310] binary format item [307] ::= escape [488], (number [257], "f" | number [257])*, "b", "(", shelf item reference [459], ")"

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

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

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

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

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

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

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

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

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

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

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

[321] stream format item [307] [318] ::= escape [488], (number [257], "f" | "k" | "l" | "u" | "e")*, "g", "(", (shelf item reference [459] | pattern name [344]), ")"

[322] symbol format item [307] ::= escape [488], (number [257], "f" | "k")*, "y", "(", shelf item reference [459], ")"

13.3 Boolean Expressions

[323] condition [6] [7] [8] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [85] [86] [87] [89] [131] [132] [158] [207] [223] [340] ::= (WHEN | UNLESS), boolean expression [324]

[324] boolean expression [161] [229] [231] [323] [326] ::=
expression [237]
| boolean secondary [325]

[325] boolean secondary [324] ::= shelf test secondary [470]

[326] boolean primary [244] [340] [362] ::=
shelf item reference [459]
| value function call [405]
| FALSE
| TRUE
| "~", boolean primary [326]
| argument test primary [415]
| attribute test primary [82]
| attributes test primary [83]
| catch test primary [433]
| element test primary [45]
| entity test primary [55]
| numeric test primary [264]
| pattern test primary [354]
| source test primary [298]
| stream test primary [292]
| string test primary [295]
| user-defined type test primary [151]
| ACTIVE, boolean primary [326]
| "(", boolean expression [324], ")"

Use of the ACTIVE keyword is unnecessary and is deprecated.

[327] comparer [265] [296] ::=
equivalence comparer [328]
| ascending comparer [331]
| descending comparer [332]

[328] equivalence comparer [55] [327] ::=
equality comparer [329]
| inequality comparer [330]

[329] equality comparer [241] [328] ::=
IS, EQUAL
| "="

[330] inequality comparer [241] [328] ::=
ISNT, EQUAL
| "!="

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

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

13.3.1 Built-In Switch Shelves

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

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

13.4 Pattern Expressions

[334] pattern expression [27] [29] [86] [214] [223] [340] ::= pattern product [335], ((OR | "|"), pattern product [335])*

[335] pattern product [334] [338] ::= pattern factor [336], ("=>", pattern name [344])?, pattern product [335]?

[336] pattern factor [335] ::=
(pattern entity type [345] | pattern nonentity type [346])?, pattern quaternary [337]
| pattern entity type [345], NAMED, pattern quaternary [337], (VALUED, pattern quaternary [337])?
| pattern entity type [345], VALUED, pattern quaternary [337], (NAMED, pattern quaternary [337])?

[337] pattern quaternary [336] [338] ::=
pattern prefix case-sensitivity modifier [343], pattern tertiary [338]
| pattern tertiary [338]

[338] pattern tertiary [337] ::=
pattern prefix consumption modifier [342], pattern quaternary [337], ("=>", pattern name [344])?
| (character set [349] | character class name [348]), ("**" | "++"), ("=>", pattern name [344])?, pattern product [335]
| pattern secondary [339]

[339] pattern secondary [269] [297] [338] ::= pattern primary [340], occurrence indicator [347]?

[340] pattern primary [339] ::=
character class name [348]
| character set [349]
| string literal [276]
| positional pattern [353]
| ANOTHER?, pattern name [344]
| value function call [405]
| "~", string primary [272]
| "~", boolean primary [326]
| "(", condition [323], ")"
| "(", pattern expression [334], condition [323]?, ")"

[341] pattern prefix modifier ::=
pattern prefix consumption modifier [342]
| pattern prefix case-sensitivity modifier [343]

[342] pattern prefix consumption modifier [338] [341] ::=
LOOKAHEAD
| LOOKAHEAD, NOT

[343] pattern prefix case-sensitivity modifier [337] [341] ::= UL

[344] pattern name [272] [318] [321] [335] [338] [340] [354] ::= name [479]

[345] pattern entity type [336] ::=
CDATA
| SDATA
| ENTITY

[346] pattern nonentity type [336] ::=
PCDATA
| NON-CDATA
| NON-SDATA
| TEXT

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

[348] character class name [338] [340] [352] ::=
ANY
| ANY-TEXT
| BLANK
| DIGIT
| LC
| LETTER
| SPACE
| UC
| WHITE-SPACE

[349] character set [338] [340] ::=
"[", character set term [351], (character set exception operator [350], character set term [351])?, "]"
| "[", character set exception operator [350], character set term [351], "]"

[350] character set exception operator [349] ::=
"\"
| EXCEPT

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

[352] character set product [351] ::=
character class name [348]
| constant string literal [285], (TO, constant string literal [285])?

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

13.4.1 Pattern Tests

[354] pattern test primary [326] ::= pattern name [344], (IS | ISNT), SPECIFIED

[355] hierarchical type expression [213] ::=
markup event expression [356]
| user-defined type expression [147]

13.5 Markup Events

[356] markup event expression [355] [357] ::= expression [237]

[357] markup event primary [43] [244] [360] [432] [460] ::=
built-in read-only markup-event shelf name [40]
| CREATE-ELEMENT-EVENT, element declaration primary [360], (ATTRIBUTES, shelf reference [460])?
| CREATE-PROCESSING-INSTRUCTION-EVENT, string primary [272]
| shelf item reference [459]
| value function call [405]
| "(", markup event expression [356], ")"

13.6 Markup Declarations

[358] dtd primary [244] [359] [360] ::=
built-in read-only dtd shelf name [38]
| shelf item reference [459]
| value function call [405]
| "(", expression [237], ")"

[359] entity declaration primary [244] ::=
DECLARED-GENERAL-ENTITIES, OF, dtd primary [358]
| DECLARED-PARAMETER-ENTITIES, OF, dtd primary [358]
| shelf item reference [459]
| value function call [405]
| "(", expression [237], ")"

[360] element declaration primary [244] [272] [357] [361] [362] [364] ::=
CREATE-ELEMENT-DECLARATION, string primary [272], ATTRIBUTES, shelf reference [460], CONTENT, content model primary [361]
| DECLARATION, OF, markup event primary [357]
| DECLARED-ELEMENTS, OF, dtd primary [358]
| shelf item reference [459]
| value function call [405]
| "(", expression [237], ")"

[361] content model primary [244] [360] ::= (ELEMENT-CONTENT-MODEL | MIXED-CONTENT-MODEL | ANY-CONTENT-MODEL | EMPTY-CONTENT-MODEL | CDATA-CONTENT-MODEL | RCDATA-CONTENT-MODEL | CONTENT, OF, element declaration primary [360] | shelf item reference [459] | value function call [405] | "(", expression [237], ")")

[362] attribute declaration primary [244] [365] ::= (CREATE-ATTRIBUTE-DECLARATION, attribute value declaration primary [364], DEFAULT, attribute default declaration primary [363], (CASE-SENSITIVE, boolean primary [326])? | ATTRIBUTES, OF, element declaration primary [360])

[363] attribute default declaration primary [244] [362] ::= (ATTRIBUTE-DECLARED-CURRENT | ATTRIBUTE-DECLARED-CONREF | ATTRIBUTE-DECLARED-DEFAULTED, TO, string primary [272] | ATTRIBUTE-DECLARED-FIXED, TO, string primary [272] | ATTRIBUTE-DECLARED-IMPLIED | ATTRIBUTE-DECLARED-REQUIRED | shelf item reference [459] | value function call [405] | "(", expression [237], ")")

[364] attribute value declaration primary [244] [362] ::= (ATTRIBUTE-DECLARED-CDATA | ATTRIBUTE-DECLARED-ENTITY | ATTRIBUTE-DECLARED-ENTITIES | ATTRIBUTE-DECLARED-GROUP, shelf reference [460] | 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 [360] | shelf item reference [459] | value function call [405] | "(", expression [237], ")")

[365] attribute primary [244] ::=
qualified attribute part identifier [69]
| CREATE-SPECIFIED-ATTRIBUTE, attribute declaration primary [362], FROM, string primary [272]
| CREATE-UNSPECIFIED-ATTRIBUTE, attribute declaration primary [362]
| shelf item reference [459]
| value function call [405]
| "(", expression [237], ")"

13.7 Stream Expressions

[366] stream expression ::= shelf item reference [459]

13.8 Markup Sink Expressions

[367] markup sink expression [368] ::= expression [237]

[368] markup sink primary [244] ::=
built-in markup sink name [369]
| value function call [405]
| "(", markup sink expression [367], ")"

[369] built-in markup sink name [368] ::= #SUPPRESS

13.9 Markup Source Expressions

[370] markup source expression [226] [371] ::= expression [237]

[371] markup source primary [244] ::=
built-in markup source name [39]
| value function call [405]
| "(", markup source expression [370], ")"

13.10 String Source Expressions

[372] string source expression [180] [192] [209] [236] [373] ::= expression [237]

[373] string source primary [244] ::=
built-in string source name [304]
| value function call [405]
| "(", string source expression [372], ")"

13.11 String Sink Expressions

[374] string sink expression [181] [203] ::= expression [237]

[375] string sink primary [188] [244] ::=
modified shelf item reference [443]
| string sink literal [377], modifier expression [434]?

The modifier expression [434], if specified (possibly as part of modified shelf item reference [443]), is restricted to using the modifiers defined by modifier literal for content [440].

[376] string sink literal for open [179] [185] [377] ::=
string sink literal [377]
| BUFFER

[377] string sink literal [375] [376] ::=
FILE, string primary [272]
| REFERENT, string primary [272]
| THIS, REFERENT
| value function call [405]

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

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


14 Functions

14.1 Function Definition

[378] function definition [119] ::=
external prefix function definition [379]
| external infix function definition [380]
| external conversion function definition [381]
| internal prefix function definition [382]
| internal infix function definition [383]
| internal conversion function definition [384]

[379] external prefix function definition [378] [399] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, shelf class [397]?, type [133]?, prefix function signature definition [386], external function binding [403]

[380] external infix function definition [378] [399] ::= (DEFINE | EXPORT), EXTERNAL, OVERLOADED?, type [133], infix function signature definition [387], external function binding [403]

[381] external conversion function definition [378] [399] ::= (DEFINE | EXPORT), EXTERNAL, type [133], conversion function signature definition [388], external function binding [403]

[382] internal prefix function definition [378] [399] ::= (DEFINE | EXPORT), function categorization kind [385]?, shelf class [397]?, type [133]?, prefix function signature definition [386], internal function binding [404]

[383] internal infix function definition [378] [399] ::= (DEFINE | EXPORT), OVERLOADED?, type [133], infix function signature definition [387], internal function binding [404]

[384] internal conversion function definition [378] [399] ::= (DEFINE | EXPORT), type [133], conversion function signature definition [388], internal function binding [404]

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

[386] prefix function signature definition [379] [382] ::= FUNCTION, prefix function name [483], function argument list definition [391]?

[387] infix function signature definition [380] [383] ::= INFIX-FUNCTION, VALUE, type [133], name [479], infix function name [482], VALUE, type [133], name [479]

[388] conversion function signature definition [381] [384] ::= CONVERSION-FUNCTION, function argument definition [394]

[389] function name [390] [414] ::= name [479]

[390] require function definition [119] ::= REQUIRE, type [133]?, FUNCTION, function name [389], function argument list definition [391]?

[391] function argument list definition [386] [390] ::=
parenthesized function argument list definition [392]
| unparenthesized function argument list definition [393]

[392] parenthesized function argument list definition [391] ::=
"(", ")"
| "(", function argument definition [394], (argument separator [401], function argument definition [394])*, (argument separator [401], remainder argument definition [398], (argument separator [401], ".", ".", ".")?, ")")?
| "(", remainder argument definition [398], argument separator [401], ".", ".", ".", ")"

[393] unparenthesized function argument list definition [391] ::=
argument herald [402]?, function argument definition [394], (argument herald [402], function argument definition [394])*, (argument herald [402], remainder argument definition [398], (argument herald [402], ".", ".", ".")?)?
| argument herald [402], remainder argument definition [398], (argument herald [402], ".", ".", ".")?
| remainder argument definition [398], argument herald [402], ".", ".", "."

[394] function argument definition [388] [392] [393] ::=
expression argument definition [395]
| shelf class argument definition [396]
| converting argument definition [399]

[395] expression argument definition [394] [422] ::= VALUE, type [133], name [479], (OPTIONAL, (INITIAL, "{", expression [237], "}")?)?

[396] shelf class argument definition [394] [422] ::= shelf class [397], first-class type [134], name [479], (OPTIONAL, (INITIAL, shelf literal [457])?)?

[397] shelf class [379] [382] [396] [460] ::=
MODIFIABLE
| READ-ONLY
| WRITE-ONLY

[398] remainder argument definition [392] [393] ::= REMAINDER, first-class type [134], name [479]

[399] converting argument definition [394] ::= VALUE, "(", (ANY | source type name [400], ((OR | "|"), source type name [400])*), INTO, first-class type [134], ")", name [479]

A converting argument definition [399] is only allowed as the first argument of an OVERLOADED external prefix function definition [379] or internal prefix function definition [382], as an argument of an OVERLOADED external infix function definition [380] or internal infix function definition [383], or as the argument of an external conversion function definition [381] or internal conversion function definition [384].

[400] source type name [399] ::=
type [133]
| NUMERIC-LITERAL

[401] argument separator [392] [407] [420] [430] ::=
argument herald [402]
| ","

[402] argument herald [393] [401] [408] [409] [421] [431] ::= name [479]

[403] external function binding [379] [380] [381] ::= AS, system-specific function name [491], (IN, FUNCTION-LIBRARY, system-specific library name [492])?

[404] internal function binding [382] [383] [384] ::=
AS, local scope [154]
| ELSEWHERE

14.2 Function Invocation

[405] value function call [149] [244] [254] [272] [326] [340] [357] [358] [359] [360] [361] [363] [364] [365] [368] [371] [373] [377] [460] ::=
prefix function name [483], parenthesized call arguments [407]
| prefix function name [483], unparenthesized call arguments [408]

[406] void function call [159] [236] ::=
prefix function name [483], parenthesized call arguments [407]
| prefix function name [483], void unparenthesized call arguments [409]

[407] parenthesized call arguments [405] [406] [432] ::= "(", (argument expression [410], (argument separator [401], argument expression [410])*)?, ")"

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

[409] void unparenthesized call arguments [406] ::= (argument herald [402]?, argument expression [410], (argument herald [402], argument expression [410])*)?

[410] argument expression [407] [409] ::= expression [237]

[411] argument primary [148] [243] [253] [408] ::= expression primary [244]

14.3 External Function Associations

[412] set external function association action [159] ::=
SET, external function identification [414], TO, system-specific function name [491]
| SET, FUNCTION-LIBRARY, OF, external function identification [414], TO, system-specific library name [492]

[413] external function association enquiry [272] ::= (FUNCTION-LIBRARY, OF)?, external function identification [414]

[414] external function identification [412] [413] ::=
(EXTERNAL-FUNCTION | EXTERNAL-OUTPUT-FUNCTION), function name [389]
| CREATOR, OF, user-defined type name [146]

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

14.4 Function Argument Tests

[415] argument test primary [326] ::= shelf reference [460], (IS | ISNT), SPECIFIED


15 Catch and Throw

15.1 Catch Definitions

[416] catch definition [119] ::= (DECLARE | EXPORT | REQUIRE), catch signature [417]

[417] catch signature [416] ::= CATCH, catch name [418], catch argument list definition [419]?

[418] catch name [417] [429] [432] [433] ::= name [479]

[419] catch argument list definition [417] ::=
parenthesized catch argument list definition [420]
| unparenthesized catch argument list definition [421]

[420] parenthesized catch argument list definition [419] ::=
"(", ")"
| "(", catch argument definition [422], (argument separator [401], catch argument definition [422])*, ")"

[421] unparenthesized catch argument list definition [419] ::= argument herald [402]?, catch argument definition [422], (argument herald [402], catch argument definition [422])*

[422] catch argument definition [420] [421] ::=
expression argument definition [395]
| shelf class argument definition [396]

15.2 Throws

[423] built-in catch invocation [156] ::=
external-exception invocation [424]
| program-error invocation [425]
| markup-start invocation [426]
| markup-end invocation [427]
| markup-point invocation [428]

[424] external-exception invocation [423] ::= #EXTERNAL-EXCEPTION, (IDENTITY, name [479])?, (MESSAGE, name [479])?, (LOCATION, name [479])?

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

[425] program-error invocation [423] ::= #PROGRAM-ERROR, (CODE, name [479])?, (MESSAGE, name [479])?, (LOCATION, name [479])?

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

[426] markup-start invocation [423] ::= #MARKUP-START, name [479]

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

[427] markup-end invocation [423] ::= #MARKUP-END, name [479]

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

[428] markup-point invocation [423] ::= #MARKUP-POINT, name [479]

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

[429] catch invocation [156] ::=
catch name [418], parenthesized invocation arguments [430]
| catch name [418], unparenthesized invocation arguments [431]

[430] parenthesized invocation arguments [429] ::= "(", (name [479], (argument separator [401], name [479])*)?, ")"

[431] unparenthesized invocation arguments [429] ::= (argument herald [402]?, name [479], (argument herald [402], name [479])*)?

[432] throw invocation [196] ::=
catch name [418], parenthesized call arguments [407]
| catch name [418], unparenthesized call arguments [408]
| #MARKUP-START, markup event primary [357]
| #MARKUP-END, markup event primary [357]
| #MARKUP-POINT, markup event primary [357]

15.3 Catch Tests

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


16 Stream Modifiers

[434] modifier expression [179] [185] [188] [375] [443] ::=
WITH, modifier literal [436], (WITH, modifier literal [436])*
| WITH, modifier subexpression [435]

[435] modifier subexpression [434] ::= "(", modifier literal [436], ((AND | "&"), modifier literal [436])*, ")"

[436] modifier literal [434] [435] ::= modifier literal for open [437]

[437] modifier literal for open [436] ::=
modifier literal for set [438]
| BINARY-MODE
| BUFFERED
| TEXT-MODE
| UNBUFFERED

[438] modifier literal for set [188] [437] ::=
modifier literal for reopen [439]
| APPEND

[439] modifier literal for reopen [185] [438] ::=
modifier literal for content [440]
| modifier literal for referents [441]
| modifier literal for break-width [442]

[440] modifier literal for content [375] [439] ::=
constant string literal [285]
| BINARY, numeric subexpression [246]
| DOMAIN-FREE

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

[441] modifier literal for referents [117] [439] ::=
REFERENTS-ALLOWED, (DEFAULTING, "{", string expression [267], (",", string expression [267])?, "}")?
| REFERENTS-DISPLAYED
| REFERENTS-NOT-ALLOWED

[442] modifier literal for break-width [439] ::= BREAK-WIDTH, numeric subexpression [246], (number [257] | TO, numeric subexpression [246])?

[443] modified shelf item reference [179] [182] [185] [375] ::= shelf item reference [459], modifier expression [434]?


17 Shelves

17.1 Shelf Definitions

[444] global shelf definition [119] ::= EXPORT?, global shelf class [446], global shelf declaration [447], ((AND | "&"), global shelf declaration [447])*

[445] require shelf definition [119] ::= REQUIRE, global shelf class [446], first-class type [134], shelf name [464]

[446] global shelf class [444] [445] ::=
CONSTANT
| DOMAIN-BOUND?, GLOBAL

[447] global shelf declaration [444] ::=
shelf pre-declaration [452]
| shelf declaration [453]

[448] local declaration [154] ::=
global shelf save declaration [449]
| groups save declaration [450]
| local shelf declaration [451]

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

[450] groups save declaration [448] ::= SAVE, GROUPS

[451] local shelf declaration [448] ::= LOCAL, shelf declaration [453], ((AND | "&"), shelf declaration [453])*

[452] shelf pre-declaration [447] ::= first-class type [134], shelf alias [463], (fixed-size shelf declaration [456] | variable-size shelf pre-declaration [454])?, ELSEWHERE

A shelf pre-declaration [452] must be paired with a shelf declaration [453] somewhere else in the current module that is used to complete the declaration.

[453] shelf declaration [143] [447] [451] [452] [458] ::= first-class type [134], shelf alias [463], (fixed-size shelf declaration [456] | variable-size shelf declaration [455])?, (INITIAL, shelf literal [457])?

[454] variable-size shelf pre-declaration [452] ::= VARIABLE, (TO, constant numeric expression [259])?

[455] variable-size shelf declaration [453] ::= VARIABLE, (TO, constant numeric expression [259])?, (INITIAL-SIZE, constant numeric expression [259])?

[456] fixed-size shelf declaration [452] [453] ::= SIZE, constant numeric expression [259]

[457] shelf literal [205] [221] [396] [453] [458] [460] ::= "{", shelf literal item [458], (",", shelf literal item [458])*, "}"

[458] shelf literal item [457] ::= (expression [237] | UNATTACHED), (WITH, KEY, expression [237])?

When a shelf literal [457] appears in a shelf declaration [453], the number of initializers in expression [237] must match the declared size of the shelf, if any.

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

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

17.2 Shelf References

[459] shelf item reference [150] [160] [163] [167] [168] [169] [172] [174] [183] [184] [186] [189] [196] [205] [244] [254] [255] [272] [274] [292] [308] [310] [314] [319] [321] [322] [326] [357] [358] [359] [360] [361] [363] [364] [365] [366] [443] [470] ::=
shelf reference [460], indexer [466]?
| NEW, new shelf item reference [461]
| NEW, "?", guarded new shelf item reference [462]
| "(", shelf item reference [459], ")"

[460] shelf reference [162] [165] [166] [221] [256] [357] [360] [364] [415] [459] [461] [462] [470] ::=
shelf name [464]
| shelf literal [457]
| record field reference [145]
| value function call [405]
| ELEMENTS, ancestry qualifier [41]
| CURRENT, ELEMENTS, ancestry qualifier [41]?

When value function call [405] is used as a shelf reference [460], the function definition must have specified a shelf class [397].

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

[461] new shelf item reference [176] [459] ::= shelf reference [460], key indexer [468]?, ((AFTER | BEFORE), indexer [466])?

[462] guarded new shelf item reference [176] [459] ::= shelf reference [460], key indexer [468]

[463] shelf alias [205] [210] [213] [216] [221] [452] [453] ::= name [479]

[464] shelf name [445] [449] [460] ::=
name [479]
| built-in shelf name [465]

[465] built-in shelf name [464] ::=
built-in read-only dtd shelf name [38]
| built-in read-only numeric shelf name [266]
| built-in read-only markup-event shelf name [40]
| 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 [333]

[466] indexer [69] [70] [204] [273] [459] [461] ::=
item indexer [467]
| key indexer [468]
| lastmost indexer [469]

[467] item indexer [69] [274] [466] ::= "[", numeric expression [245], "]"

[468] key indexer [233] [235] [255] [461] [462] [466] ::= "{", string expression [267], "}"

[469] lastmost indexer [466] ::= LASTMOST

17.3 Shelf Tests

[470] shelf test secondary [325] ::=
shelf item reference [459], (IS | ISNT), KEYED
| shelf reference [460], (HAS | HASNT), KEY, string primary [272]
| REFERENTS, (HAS | HASNT), KEY, string primary [272]


18 Macros

[471] macro definition [118] ::= MACRO, macro name [472], parameter template [473]*, IS, replacement template item [478]*, MACRO-END

[472] macro name [471] ::= macro token [475]+

[473] parameter template [471] ::=
ARG, macro parameter [474], macro token [475]+
| TOKEN, macro parameter [474], macro token [475]*

[474] macro parameter [473] [475] [478] ::=
delimiter token [476]
| name [479]

[475] macro token [472] [473] ::= LITERAL?, macro parameter [474]

[476] delimiter token [474] [478] ::=
infix function name [482]
| delimiter character [477]

[477] delimiter character [476] ::= "(" | ")" | "{" | "}" | "[" | "]" | "`" | ":" | "."

[478] replacement template item [471] ::=
macro parameter [474]
| LITERAL?, string literal [276]
| LITERAL?, delimiter token [476]
| LITERAL?, name [479]
| LITERAL?, number [257]


19 Lexeme Productions

[479] name [37] [54] [97] [101] [102] [103] [105] [106] [145] [146] [316] [344] [387] [389] [395] [396] [398] [399] [402] [418] [424] [425] [426] [427] [428] [430] [431] [463] [464] [474] [478] [482] [483] ::= (letter [480] | high bit character [495]), (digit [481] | (letter [480] | high bit character [495]) | user-defined name character [493] | "." | "-" | "_")* | "#", constant string literal [285]

[480] letter [479] ::= "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"

[481] digit [258] [479] ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

[482] infix function name [387] [476] [487] ::= infix function start character [484], function following character [486]* | name [479]

[483] prefix function name [386] [405] [406] ::= prefix function start character [485], function following character [486]* | name [479]

[484] infix function start character [482] ::= function following character [486] | prefix function start character [485]

[485] prefix function start character [483] [484] ::= "!" | "-" | "+" | "%" | "?" | "/" | "~" | "$" | "\" | "@" | "^" | ","

[486] function following character [482] [483] [484] ::= "*" | "=" | "|" | "<" | ">" | "&"


20 Dynamically-Defined Lexical Tokens

[487] user-defined infix function name [148] [243] [253] ::= Any infix function name [482] defined in a program rather than by OmniMark, and which are not overloadings of operators defined by OmniMark to be overloadable.

[488] escape [289] [290] [291] [308] [309] [310] [311] [312] [313] [314] [315] [316] [317] [318] [319] [320] [321] [322] [489] ::= The escape [488] character is defined by an escape declaration [113]. If there is no escape declaration [113], the escape character is "%".

[489] unescaped character [278] [279] [287] [288] ::= An unescaped character [489] is any character that is not a "'", a """, a control character, or escape [488].

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

[491] system-specific function name [138] [403] [412] ::= A system-specific function name [491] is implemented as a constant string expression [280].

[492] system-specific library name [138] [403] [412] ::= A system-specific library name [492] is implemented as a constant string expression [280].

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

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

[495] high bit character [479] ::= A high bit character [495] is any character whose byte value exceeds 127.

Copyright © Stilo Corporation, 2003-2020. All rights reserved.
ETR62, 2020/4/3