File: ebnf-ebx.el.html

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


This is part of ebnf2ps package.

This package defines a parser for EBNF used to specify XML (EBNFX).

See ebnf2ps.el for documentation.

EBNFX Syntax
------------

See the URL: https://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation
(Extensible Markup Language (XML) 1.0 (Third Edition))


rule ::= symbol '::=' expression
/* rules are separated by at least one blank line. */

expression ::= concatenation ('|' concatenation)*

concatenation ::= exception*

exception ::= term ('-' term)?

term ::= factor ('*' | '+' | '?')?

factor ::= hex-char+
         | '[' '^'? ( char ( '-' char )? )+ ']'
         | '"' 'string' '"'
         | "'" "string" "'"
         | '(' expression ')'
         | symbol

symbol ::= 'upper or lower case letter'
           ('upper or lower case letter' | '-' | '_')*
/* upper and lower 8-bit accentuated characters are included */

hex-char ::= '#x' [0-9A-Fa-f]+

char ::= hex-char | 'any character except control characters'
/* 8-bit accentuated characters are included */

any-char ::= char | 'newline' | 'tab'

ignore ::= '[' ('wfc' | 'WFC' | 'vc' | 'VC') ':' ( any-char - ']' )* ']'

comment ::= '/*' ( any-char - '*/' ) '*/'

Below is the Notation section extracted from the URL cited above.

6 Notation

The formal grammar of XML is given in this specification using a simple Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines one symbol, in the form

symbol ::= expression

Symbols are written with an initial capital letter if they are the start symbol of a regular language, otherwise with an initial lowercase letter. Literal strings are quoted.

Within the expression on the right-hand side of a rule, the following expressions are used to match strings of one or more characters:

#xN

    where N is a hexadecimal integer, the expression matches the character
    whose number (code point) in ISO/IEC 10646 is N. The number of leading
    zeros in the #xN form is insignificant.

[a-zA-Z], [#xN-#xN]

    matches any Char with a value in the range(s) indicated (inclusive).

[abc], [#xN#xN#xN]

    matches any Char with a value among the characters enumerated.
    Enumerations and ranges can be mixed in one set of brackets.

[^a-z], [^#xN-#xN]

    matches any Char with a value outside the range indicated.

[^abc], [^#xN#xN#xN]

    matches any Char with a value not among the characters given.
    Enumerations and ranges of forbidden values can be mixed in one set of
    brackets.

"string"

    matches a literal string matching that given inside the double quotes.

'string'

    matches a literal string matching that given inside the single quotes.

These symbols may be combined to match more complex patterns as follows, where A and B represent simple expressions:

(expression)

    expression is treated as a unit and may be combined as described in this
    list.

A?

    matches A or nothing; optional A.

A B

    matches A followed by B. This operator has higher precedence than
    alternation; thus A B | C D is identical to (A B) | (C D).

A | B

    matches A or B.

A - B

    matches any string that matches A but does not match B.

A+

    matches one or more occurrences of A. Concatenation has higher
    precedence than alternation; thus A+ | B+ is identical to (A+) | (B+).

A*

    matches zero or more occurrences of A. Concatenation has higher
    precedence than alternation; thus A* | B* is identical to (A*) | (B*).

Other notations used in the productions are:

/* ... */

    comment.

[ wfc: ... ]

    well-formedness constraint; this identifies by name a constraint on
    well-formed documents associated with a production.

[ vc: ... ]

    validity constraint; this identifies by name a constraint on valid
    documents associated with a production.


Differences Between EBNFX And ebnf2ps EBNFX
-------------------------------------------

Besides the characters that EBNFX accepts, ebnf2ps EBNFX accepts also the underscore (_) and minus (-) for rule name and european 8-bit accentuated characters (from \240 to \377) for rule name, string and comment. Also rule name can start with upper case letter.


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Defined variables (2)

ebnf-ebx-lexValue returned by ‘ebnf-ebx-lex’ function.
ebnf-ebx-token-tableVector used to map characters to a lexical token.

Defined functions (10)

ebnf-ebx-concatenation(TOKEN)
ebnf-ebx-exception(TOKEN)
ebnf-ebx-factor(TOKEN)
ebnf-ebx-hex-character(&optional NO-ERROR)
ebnf-ebx-initialize()
ebnf-ebx-lex()
ebnf-ebx-parser(START)
ebnf-ebx-rule(TOKEN)
ebnf-ebx-string(DELIM)
ebnf-ebx-term(TOKEN)

Defined faces (0)