Name
cx:ebnf-convert — Converts other EBNF notations to W3C EBNF.
Synopsis
The cx:ebnf-convert
step is a wrapper around
Gunther Rademacher’s
grammar converter.
Input port | Primary | Sequence | Content types |
---|---|---|---|
source | ✔ | text |
Output port | Primary | Sequence | Content types |
---|---|---|---|
result | ✔ | xml text |
Option name | Type | Values | Default value |
---|---|---|---|
epsilon-references | xs:boolean | false() | |
factoring | xs:string | ('full-left', 'left-only', 'full-right', 'right-only', 'none') | 'full-left' |
inline-terminals | xs:boolean | true() | |
notation | xs:string? | ('abnf', 'antlr_3', 'antlr_4', 'bison', 'gold', 'instaparse', 'ixml', 'javacc', 'jison', 'pegjs', 'phythia', 'pss', 'rex_5_9', 'w3c', 'xtext') | () |
remove-recursion | xs:string | ('full', 'left', 'right', 'none') | 'full' |
timestamp | xs:boolean | true() | |
verbose | xs:boolean | false() | |
xml | xs:boolean | false() |
<p:import href="https://xmlcalabash.com/ext/library/ebnf-convert.xpl"/>
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
| <p:input port="source" content-types="text"/>
| <p:output port="result" content-types="xml text"/>
| <p:option name="factoring"
5 | as="xs:string"
| select="'full-left'"
| values="('full-left', 'left-only', 'full-right', 'right-only', 'none')"/>
| <p:option name="remove-recursion"
| as="xs:string"
10 | select="'full'"
| values="('full', 'left', 'right', 'none')"/>
| <p:option name="inline-terminals" as="xs:boolean" select="true()"/>
| <p:option name="epsilon-references" as="xs:boolean" select="false()"/>
| <p:option name="notation"
15 | as="xs:string?"
| values="('abnf', 'antlr_3', 'antlr_4', 'bison', 'gold', 'instaparse', 'ixml', 'javacc', 'jison', 'pegjs', 'phythia', 'pss', 'rex_5_9', 'w3c', 'xtext')"/>
| <p:option name="xml" as="xs:boolean" select="false()"/>
| <p:option name="verbose" as="xs:boolean" select="false()"/>
| <p:option name="timestamp" as="xs:boolean" select="true()"/>
20 |</p:declare-step>
Errors
Code | Description |
---|---|
cxerr:XC0022 | It is a dynamic
error (cxerr:XC0022 ) if the grammar conversion fails. |
Description
There are wide variety of different
EBNF
notations. This step converts many of them to the EBNF notation
defined by the W3C.
This notation is used in the XML specification, in the XPath and XQuery family of specifications,
and, perhaps most significantly in this context,
by the cx:railroad
step to make railroad diagrams.
The input notations are:
antlr_3
, ANTLR version 3.antlr_4
, ANTLR version 4.bison
, Bison.gold
, The GOLD Parser Builder.instaparse
, Instaparse.ixml
, Invisible XML.javacc
, JavaCC.jison
, Jison.pegjs
, PEG.js.w3c
, W3C EBNF (for notational completness).xtext
, Xtext.
The notations phythia
, pss
, and rex_5_9
are legacy formats.
It is a dynamic
error (cxerr:XC0022
) if the grammar conversion fails.
This conversion process is also available implicitly in the cx:railroad
step.
Dependencies
This step is included in the XML Calabash application. If you are getting XML Calabash from Maven, you will also need to include the extension dependency:
com.xmlcalabash:ebnf-convert:3.0.0-alpha24
The following third-party dependencies will also be included transitively:
de.bottlecaps.ebnf-convert:ebnf-convert-lib:0.70