From 615f2a8a0ffd0517bd80928839200a2882ea7151 Mon Sep 17 00:00:00 2001 From: Martin Stoilov Date: Tue, 5 Apr 2022 16:02:10 +0200 Subject: [PATCH] Added modified version of the XML bnf. --- tests/datapatterns/xml2.rpa | 122 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tests/datapatterns/xml2.rpa diff --git a/tests/datapatterns/xml2.rpa b/tests/datapatterns/xml2.rpa new file mode 100644 index 0000000..99adbe8 --- /dev/null +++ b/tests/datapatterns/xml2.rpa @@ -0,0 +1,122 @@ +#!emitall +#!emit STag +#!emit ETag +#!emit Attribute +#!abort ETag + +# BNF productsions from the XML spcification. + +Char ::= [#x9] | [#xA] | [#xD] | [#x20-#xD7FF] | + [#xE000-#xFFFD] | [#x10000-#x10FFFF] # [2] +S ::= ( [#x20] | [#x9] | [#xD] | [#xA] )* # [3] +NameStartChar ::= [:] | [A-Z] | [_] | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | + [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | + [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | + [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] # [4] +NameChar ::= | [\-\.]|[0-9]|[#xB7]|[#x0300-#x036F]|[#x203F-#x2040] # [4a] +Name ::= * # [5] +Names ::= ([#x20])* # [6] +Nmtoken ::= + # [7] +Nmtokens ::= ([#x20])* # [8] + +# Literals +EntityValue ::= ( '"' ( ^[%&"] | | )* '"' ) | + ( "'" ( ^[%&'] | | )* "'" ) # [9] +AttValue ::= '"' (^[<&"] | )* '"' | "'" (^[<&'] | )* "'" # [10] +SystemLiteral ::= ('"' ^["]* '"') | ("'" ^[']* "'") # [11] +PubidLiteral ::= ('"' * '"' ) | ("'" ( - "'")* "'") # [12] +PubidChar ::= [#x20] | [#xD] | [#xA] | [a-zA-Z0-9] | '-' | '#' | ['()+,./::=?;!*@$_%] # [13] + +# Character Data +CharData ::= ^[<&] +Comment ::= '' # [15] + +# Processing Instructions +PI ::= ' ( (( - '?>')*))? '?>' # [16] +PITarget ::= - [Xx][Mm][Ll] # [17] + + +# CDATA Section +CDSect ::= # [18] +CDStart ::= ' - ']]>')* # [20] +CDEnd ::= ']]>' # [21] + +# Prolog +XMLDecl ::= ' ? ? ? '?>' # [23] +VersionInfo ::= 'version' ("'" "'" | '"' '"') # [24] +Eq ::= ? '=' ? # [25] +VersionNum ::= '1.' [0-9]+ # [26] +Misc ::= | | # [27] +doctypedecl ::= '()??('['']'?)?'>' # [28] +DeclSep ::= | # [28a] +intSubset ::= ( | )* # [28b] + +markupdecl ::= | | + | | | # [29] +prolog ::= ( | )* ( *)? # [22] + +# External Subset +extSubset ::= ? # [30] +extSubsetDecl ::= ( | | )* # [31] +SDDecl ::= 'standalone' (("'" ('yes' | 'no') "'") | + ('"' ('yes' | 'no') '"')) # [32] + +#Start-tag +STag ::= '<' ()* ? '>' # [40] +Attribute ::= # [41] +ETag ::= ' ? '>' # [42] +content ::= ?((|||| + )?)* # [43] +EmptyElemTag ::= '<' ()* ? '/>' # [44] + +# Element +element ::= | ( * ()) # [39] + +elementdecl ::= '? '>' # [45] +contentspec ::= 'EMPTY' | 'ANY' | | # [46] +children ::= ( | ) ('?' | '*' | '+')? # [47] +cp ::= (||) ('?' | '*' | '+')? # [48] +choice ::= '(' ? (? '|' ? )+ ? ')' # [49] +seq ::= '(' ? (? ',' ? )* ? ')' # [50] +Mixed ::= '(' ? '#PCDATA' (? '|' ? )* ? ')*'| + '(' ? '#PCDATA' ? ')' # [51] + +AttlistDecl ::= ' * ? '>' # [52] +AttDef ::= # [53] +AttType ::= | | # [54] +StringType ::= 'CDATA' # [55] +TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' + | 'NMTOKEN' | 'NMTOKENS' # [56] +EnumeratedType ::= | # [57] +NotationType ::= 'NOTATION' '(' ? (? '|' ?)*? ')' # [58] +Enumeration ::= '(' ? (? '|' ? )* ? ')' # [59] +DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' )? ) # [60] +conditionalSect ::= | # [61] +includeSect ::= '? 'INCLUDE' ? '[' ']]>' # [62] +ignoreSect ::= '? 'IGNORE' ? '[' * ']]>' # [63] +ignoreSectContents ::= ? (' ']]>' ? )* # [64] +Ignore ::= ( - (''))+ + + +CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' # [66] +Reference ::= | # [67] +EntityRef ::= '&' ';' # [68] +PEReference ::= '%' ';' # [69] +EntityDecl ::= | # [70] +GEDecl ::= ' ? '>' # [71] +PEDecl ::= ' '%' ? '>' # [72] +EntityDef ::= | ( ?) # [73] +PEDef ::= | # [74] +ExternalID ::= 'SYSTEM' | + 'PUBLIC' # [75] +NDataDecl ::= 'NDATA' # [76] +TextDecl ::= '? ? '?>' # [77] +extParsedEnt ::= ? # [78] +EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* # [81] +NotationDecl ::= ' ( | )? '>' # [82] +PublicID ::= 'PUBLIC' # [83] +EncodingDecl ::= 'encoding' ('"' '"' | "'" "'" ) # [80] + +document ::= ? * # [1] +exec ::= -- 1.7.9.5