Crates.io | nxml |
lib.rs | nxml |
version | 3.0.0 |
source | src |
created_at | 2023-01-13 04:17:36.411045 |
updated_at | 2023-04-22 18:46:02.357872 |
description | A parser for NXML (NXML is not XML!) |
homepage | https://github.com/megahomyak/nxml |
repository | https://github.com/megahomyak/nxml |
max_upload_size | |
id | 757611 |
size | 17,257 |
NXML is a markup language that is not XML. It was based on XML, but went in a very different direction and now does not resemble XML at all.
hello
) or a sequence ([I|am|a|sequence]
)[
and ]
) surround the sequencetext[sequence][sequence]text
)|
) denotes the end of a text node (otherwise text nodes end at the end of input or at a sequence boundary (a bracket)). This can be used to place text nodes one after another or to create an empty text node|
, [
, ]
or \
) can be escaped with a backslash (\
)special_character ::= "[" | "]" | "|" | "\\"
text_character ::= !special_character | "\\\\" | "\\[" | "\\]" | "\\|"
text ::= text text_character | text_character | text "|" | "|"
sequence_of_nodes ::= sequence_of_nodes node | node
node ::= text | "[" + sequence_of_nodes + "]" | "[]"
[to-do list|
[buy some groceries|[
lettuce |
cucumber |
ketchup
]]
[finish NXML|[
add syntax explanation to the README |
update syntax examples |
rewrite the parser
]]
[do the homework]
]
[user|
[id|123]
[name|Paul]
[surname|Brown]
[profession|Architect]
[friend ids|[234|345|456]]
]
[
[message|
[from|Alice]
[to|Bob]
[contents|Hello!]
]
[message|
[from|Bob]
[to|Alice]
[contents|Hi!]
]
]
[ARTICLE|
[TITLE|Cookies are good]
[CONTENTS|
[PARAGRAPH|
[OUTER REFERENCE|[URL|https://en.wikipedia.org/wiki/Cookie][TEXT|Cookies]] are good!
]
]
]
you can use the sequential parser to parse bare sequential nodes |
something |
something
an empty text node! -> || <- here it is!
another one, this time inside a sequence: [|] (it is between the opening bracket and the vertical bar)