Schema
namespace local = ""
namespace inh = inherit
namespace xhtml = "http://www.w3.org/1999/xhtml"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"


a:documentation
[
"RELAX NG flat schema for Bluefish Language Files (bflang) containing syntax highlighting and autocompletion information for the bluefish "
xhtml:a [ href = "http://bluefish.openoffice.nl" "Bluefish" ]
" editor."
]

start =
## The root tag of a Bluefish language file (bflang2) file. It defines the human readable name, the bflang format version and some values for the compiler, indicating how much memory should be allocated.

element bflang
{
## Human readable name of the language defined; must be unique regarding other language files

attribute name { xsd:normalizedString },
## Version of the bflang2 format the file complies to

attribute version { xsd:decimal },
(
## Size of the context table. This value is an indication for the compiler how much memory should be allocated. It optimises the loading speed. As illustration: contexts="100" (4.69 Kbytes)

attribute contexts { xsd:positiveInteger },
## Size of the matches table. This value is an indication for the compiler how much memory should be allocated. It optimises the loading speed. As illustration: matches="1752" (123.19 Kbytes)

attribute matches { xsd:positiveInteger },
## Size of the DFA table, compiled patterns for each contex. This value is an indication for the compiler how much memory should be allocated. It optimises the loading speed. As illustration: table="7906" (1976.50 Kbytes)

attribute table { xsd:positiveInteger }
)?,
## Region of the language file that is always loaded, regardless if the language is used or not.

element header
{
## Every language file should have at least one unique mime type (compared to the other language files) in order to be available to the user. There can be multiple mime tags.

element mime
{
## "Content Type" or "Internet Media Type" (refer to RFC 2045-2049 and the IANA)

attribute type { xsd:token },
empty
}+,
(
## Options are links to the class/notclass attribute of <group> elements. Enabling/disabling an option turns on/off (complete) groups.

element option
{
## Option name (ID)

attribute name { xsd:ID },
## Enable (1) or disable (0) the feature/group

attribute default { xsd:boolean },
## Optional human readable description of the option (not yet used)

attribute description { xsd:string }?,
empty
}
## Links contexts, elements, groups and tags, that can be highlighted and that are used by multiple languages, with styles. Default styles are hardcoded.

element highlight
{
## Highlight name (ID)

attribute name { xsd:ID },
## Highlight style (pre-defined)

attribute style
{
## (usually) SGML/XML tag attributes

xsd:token "attribute"
## Braces, brackets and parenthesis

xsd:token "brackets"
## Comments of all styles (C-style, Shell, XML, ...)

xsd:token "comment"
## Functions in a programming language

xsd:token "function"
## Programming languages keywords

xsd:token "keyword"
xsd:token "operator"
## Programmming languages

xsd:token "preprocessor"
xsd:token "special-attribute"
xsd:token "special-function"
xsd:token "special-keyword"
xsd:token "special-tag"
xsd:token "special-tag2"
xsd:token "special-tag3"
xsd:token "special-type"
xsd:token "special-value"
## Strings, usually inside quotation marks

xsd:token "string"
## (usually) SGML/XML tags

xsd:token "tag"
xsd:token "type"
## Value of a tag

xsd:token "value"
xsd:token "variable"
xsd:token "warning"
},
empty
}
)*,
empty
},
## Language file properties.

element properties
{
(
## Specify which line and block comments are possible for the smart comment function.

element comment
{
## Type of comment

attribute type
{
## Block comment

xsd:token "block"
## Line comment

xsd:token "line"
},
## Start-pattern of a comment

attribute start { xsd:string },
## End-pattern of a block comment

attribute end { xsd:string }?,
empty
}
## Specify which characters (followed by a return) should increase the indenting.

element smartindent
{
## List of characters

attribute characters { xsd:string },
empty
}
## Define if regions that are not highlighted will be checked by the spell checker. This is typically enabled for HTML/XML like languages, and disabled (or ignored) for all programming languages.

element default_spellcheck
{
## Enable (1) or disable (0) the feature

attribute enabled { xsd:boolean },
empty
}
)+,
empty
}?,
## The region of the language file that actually defines the language. This region is only loaded when a file of this type is opened in the editor. A language definition always starts with a <context> tag.

element definition { bf.element.context* },
empty
}

bf.element.context =
## The most important attribute of a context are the symbols, a string of characters that are all 'symbol' characters for this context. A 'symbol' character is a character that may start or end the next match. Usually all spacing is a symbol, and in programming languages all operators are symbols. Contexts can be reused later by using an ID during definition and referencing this ID later.

element context
{
(
(
## List of characters

attribute symbols { xsd:string },
bf.attribute.highlight,
## Context ID to reuse it later

attribute id { xsd:ID { pattern = "c\.[a-zA-Z0-9_.]+" } }?,
( bf.element.elementbf.element.groupbf.element.tag )+
)
## ID of context to reuse (no other attributes or elements are allowed)

attribute idref { xsd:IDREF { pattern = "c\.[a-zA-Z0-9_.]+" } }
),
empty
}

bf.element.element =
## Language element that is syntax highlighted, autocompleted or has reference information. The most important attribute is 'pattern': a keyword (e.g. a function name) or a regular expression (if attribute 'is_regex' is set to '1'). It might contain other elements, contexts, groups and references. To reuse an element it must have only the 'idref' attribute.

element element
{
(
(
## Pattern: keyword, function, string, regular expression (limited)

attribute pattern { xsd:string },
bf.attribute.autocomplete.element,
bf.attribute.autocomplete.extended,
bf.attribute.class.notclass,
bf.attribute.case_insens,
bf.attribute.highlight,
bf.attribute.is_regex,
(
## Element pattern starts a block ('1')

attribute starts_block { xsd:boolean }
| (
## Element pattern ends a block ('1')

attribute ends_block { xsd:boolean },
## ID of element containing start-pattern of block to end

attribute blockstartelement { xsd:IDREF { pattern = "[et]\.[a-zA-Z0-9_.]+" } }
)
)?,
## UNKNOWN / TODO

attribute blockhighlight { xsd:string }?,
## Number of contexts to be ended

attribute ends_context { xsd:positiveInteger }?,
attribute id
{
## ID to reuse element

xsd:ID { pattern = "e\.[a-zA-Z0-9_.]+" }
}?,
## UNKNOWN / TODO

attribute mayfold { [ a:defaultValue = "0" ] xsd:boolean }?,
## Special attribute to enable automatic closure of the generic tags only used for generic XML highlighting, and only for the element that starts the generic xml tag pattern

attribute tagclose_from_blockstack { [ a:defaultValue = "0" ] xsd:boolean }?,
( bf.element.contextbf.element.elementbf.element.groupbf.element.reference )*
)
## ID of element to reuse (no other attributes or elements are allowed)

attribute idref { xsd:IDREF { pattern = "e\.[a-zA-Z0-9_.]+" } }
),
empty
}

bf.element.group =
## Group multiple tags or elements that share the same attribute values for a subset of attributes: 'attrib_autocomplete_append', 'attribhighlight', 'autocomplete', 'autocomplete_append', 'case_insens', 'class', 'highlight', 'is_regex' and/or 'notclass'. These attributes are then only set for the group tag, and not for the elements or tags immediately within this group tag.

element group
{
bf.attribute.autocomplete.attribute,
bf.attribute.autocomplete.element,
bf.attribute.autocomplete.extended,
bf.attribute.attribhighlight,
bf.attribute.case_insens,
bf.attribute.class.notclass,
bf.attribute.highlight,
bf.attribute.is_regex,
( bf.element.elementbf.element.groupbf.element.tag )+,
empty
}

bf.element.tag =
## Convenience element for SGML/XML based languages. Everything within tag is possible with a combination of multiple element and context tags.

element tag
{
(
(
## ID of element to reuse (no other attributes or elements are allowed)

attribute name { xsd:token },
bf.attribute.autocomplete.attribute,
bf.attribute.autocomplete.element,
bf.attribute.autocomplete.extended,
bf.attribute.case_insens,
bf.attribute.highlight,
bf.attribute.is_regex,
(
## List of comma-separated attributes

attribute attributes { xsd:string { pattern = "[a-zA-Z0-9][a-zA-Z0-9:,-_]+" } },
bf.attribute.attribhighlight
)?,
## ID to reuse tag

attribute id { xsd:ID { pattern = "t\.[a-zA-Z0-9_.]+" } }?,
## Do not automatically close the tag ('1')

attribute no_close { xsd:boolean }?,
## The tag does not need to be closed, like SGML Shorttags ('1'). This is currently only used in HTML for tags like <br>.

attribute sgml_shorttag { xsd:boolean }?,
( bf.element.contextbf.element.reference )*
)
attribute idref
{
## ID of tag to reuse (no other attributes or elements are allowed)

xsd:IDREF { pattern = "t\.[a-zA-Z0-9_.]+" }
}
),
empty
}

bf.element.reference =
## The reference contains a description of elements or tags and must only contain valid PANGO markup and text according to http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html. For the moment PANGO markup is not checked for validity!

element reference { ( textelement * { text } )*, empty }

bf.attribute.autocomplete.element =
## Enable ('1') or disable ('0') autocompletion feature for item

attribute autocomplete { xsd:boolean }?,
## Automatically appended string to item

attribute autocomplete_append { xsd:string }?

bf.attribute.autocomplete.attribute =
## Automatically appended string to attribute

attribute attrib_autocomplete_append { xsd:string }?,
## Set cursor position after auto-completion of attribute back by X characters

attribute attrib_autocomplete_backup_cursor { xsd:positiveInteger }?

bf.attribute.autocomplete.extended =
## Auto-complete regular expression with this string

attribute autocomplete_string { xsd:string }?,
## Set cursor position after auto-completion back by X characters

attribute autocomplete_backup_cursor { xsd:positiveInteger }?

bf.attribute.class.notclass =
(
## Enable item if option with ID is set/enabled

attribute class { xsd:IDREF }
## Disable item if option with ID is set/enabled

attribute notclass { xsd:IDREF }
)?

bf.attribute.attribhighlight =
## Link attribute style to highlight name/ID

attribute attribhighlight { xsd:IDREF }?

bf.attribute.case_insens =
## Pattern is case insensitive ('1')

attribute case_insens { xsd:boolean }?

bf.attribute.highlight =
## Link item style to highlight name/ID

attribute highlight { xsd:IDREF }?

bf.attribute.is_regex =
## Pattern is a regular expression ('1')

attribute is_regex { xsd:boolean }?
Index
 
start
Definitions: 1
bf.attribute.attribhighlight
Definitions: 1
bf.attribute.autocomplete.attribute
Definitions: 1
bf.attribute.autocomplete.element
Definitions: 1
bf.attribute.autocomplete.extended
Definitions: 1
bf.attribute.case_insens
Definitions: 1
bf.attribute.class.notclass
Definitions: 1
bf.attribute.highlight
Definitions: 1
bf.attribute.is_regex
Definitions: 1
bf.element.context
Definitions: 1
bf.element.element
Definitions: 1
bf.element.group
Definitions: 1
bf.element.reference
Definitions: 1
bf.element.tag
Definitions: 1