Blame docs/reference/html/lang-reference.html

Packit a7d494
Packit a7d494
<html>
Packit a7d494
<head>
Packit a7d494
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit a7d494
<title>Language Definition v2.0 Reference: GtkSourceView 3 Reference Manual</title>
Packit a7d494
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit a7d494
<link rel="home" href="index.html" title="GtkSourceView 3 Reference Manual">
Packit a7d494
<link rel="up" href="pt03.html" title="Part III. Syntax highlighting reference">
Packit a7d494
<link rel="prev" href="lang-tutorial.html" title="Language Definition v2.0 Tutorial">
Packit a7d494
<link rel="next" href="style-reference.html" title="Style Scheme Definition Reference">
Packit a7d494
<meta name="generator" content="GTK-Doc V1.28.1 (XML mode)">
Packit a7d494
<link rel="stylesheet" href="style.css" type="text/css">
Packit a7d494
</head>
Packit a7d494
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit a7d494
Packit a7d494
Packit a7d494
Home
Packit a7d494
Up
Packit a7d494
Prev
Packit a7d494
Next
Packit a7d494
Packit a7d494
Packit a7d494
Packit a7d494
Packit a7d494
Packit a7d494

Language Definition v2.0 Reference

Packit a7d494

Language Definition v2.0 Reference —

Packit a7d494
Reference to the GtkSourceView language definition file format
Packit a7d494

Packit a7d494
Packit a7d494
Packit a7d494
Packit a7d494
Packit a7d494

Overview

Packit a7d494

Packit a7d494
    The version 2 here refers to the language definition file format,
Packit a7d494
    not to the version of GtkSourceView. This reference is suitable
Packit a7d494
    for GtkSourceView 2 and 3.
Packit a7d494
  

Packit a7d494

Packit a7d494
This is an overview of the Language Definition XML format, describing the
Packit a7d494
meaning and usage of every element and attribute.  The formal definition is
Packit a7d494
stored in the RelaxNG schema file language2.rng which
Packit a7d494
should be installed on your system in the directory
Packit a7d494
${PREFIX}/share/gtksourceview-3.0/ (where
Packit a7d494
${PREFIX} can be /usr/ or
Packit a7d494
/usr/local/ if you have installed from source.
Packit a7d494

Packit a7d494

Packit a7d494
The preinstalled language files are located in
Packit a7d494
${PREFIX}/share/gtksourceview-3.0/language-specs/. Custom
Packit a7d494
user languages are usually placed in
Packit a7d494
~/.local/share/gtksourceview-3.0/language-specs/. Note:
Packit a7d494
replace 3 with 2 in the path for GtkSourceView version 2.
Packit a7d494

Packit a7d494
Packit a7d494
Packit a7d494

Some advices

Packit a7d494

Packit a7d494
The easiest way to start a new language definition is to copy a preinstalled
Packit a7d494
language definition from a language that has similar constructs as the one you
Packit a7d494
want to write a specification for. You can copy and rename a file from the
Packit a7d494
systems directory to the local user one (create the directory if it doesn't
Packit a7d494
exist yet) and edit the file accordingly.
Packit a7d494

Packit a7d494

Packit a7d494
The important thing you need to change are the id and
Packit a7d494
name of the language and the metadata properties
Packit a7d494
mimetypes and globs in the language spec. These
Packit a7d494
should resemble your new language. It might be that your files do not have an
Packit a7d494
appropriate mimetype associated yet. You can either in that case leave it
Packit a7d494
empty, or add a new mimetype (see below).
Packit a7d494

Packit a7d494

Packit a7d494
If for some reason your language spec doesn't show up in an application like
Packit a7d494
gedit, it might be a good idea to start the application from a terminal window
Packit a7d494
and see if any errors/warnings appear for your language file. This usually
Packit a7d494
gives good clues what's wrong with the specification. Note that you need to
Packit a7d494
restart the application to take into account changes in a language definition
Packit a7d494
file.
Packit a7d494

Packit a7d494
Packit a7d494
Packit a7d494

Conventions

Packit a7d494

Packit a7d494
It is better to follow the following conventions, especially if you want to
Packit a7d494
contribute upstream, and get your language definition file included in
Packit a7d494
GtkSourceView.
Packit a7d494

Packit a7d494
    Packit a7d494
  • Packit a7d494
          Indentation: 2 spaces.
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          Have the main context at the bottom.
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          Use references to def.lang.
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          Add an example in tests/syntax-highlighting/.
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          LGPL v2.1+ license (copy/paste the license header from c.lang, for
    Packit a7d494
          example).
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          Add the e-mail address of the language definition file author(s).
    Packit a7d494
        

    Packit a7d494
  • Packit a7d494
          Refer to the HACKING file for submitting your language definition
    Packit a7d494
          file upstream. If the file is not included upstream, you can also
    Packit a7d494
          add the language definition file to the GtkSourceView wiki, so
    Packit a7d494
          users can easily find it.
    Packit a7d494
        

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <language>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    The root element for Language Definition files.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements:
    Packit a7d494
    <metadata> (optional), <styles> (optional), <default-regex-options> (optional), <keyword-char-class> (optional), <definitions> (mandatory).
    Packit a7d494

    Packit a7d494
    Packit a7d494

    Attributes:

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    id (mandatory)

    Packit a7d494

    Packit a7d494
    Identifier for the description. This is used for
    Packit a7d494
    external references and must be unique among language descriptions. It can
    Packit a7d494
    contain a string of letters, digits, hyphens ("-") and
    Packit a7d494
    underscores ("_").
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    name (mandatory)

    Packit a7d494

    Packit a7d494
    The translatable name of the language presented to the user.
    Packit a7d494
    It can be marked for translation putting an underscore before the attribute
    Packit a7d494
    name (see the gettext documentation).
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    version (mandatory)

    Packit a7d494

    Packit a7d494
    The version of the XML format (currently "2.0").
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    section (optional)

    Packit a7d494

    Packit a7d494
    The translatable category in which the language has to be grouped when
    Packit a7d494
    presented to the user. It can be marked for translation putting
    Packit a7d494
    an underscore before the attribute name. Currently used categories in
    Packit a7d494
    GtkSourceView are "Source", "Script",  "Markup" and "Other", but
    Packit a7d494
    it is possible to use arbitrary categories (while usually discouraged).
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    hidden (optional)

    Packit a7d494

    Packit a7d494
    It's a hint that the language should be "hidden" from user. For instance,
    Packit a7d494
    def.lang has this flag, and a text editor should not present "default" as
    Packit a7d494
    a syntax highlighting choice.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <metadata>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    Contains optional metadata about the language definition.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Recognized elements are (all optional):
    Packit a7d494

    Packit a7d494
    mimetypes
    Packit a7d494

    Packit a7d494
    The semicolon-separated list of mimetypes associated to the language. See the
    Packit a7d494
    shared-mime-info
    Packit a7d494
    freedesktop.org specification. A language definition file shipped by
    Packit a7d494
    GtkSourceView needs to have a mimetype defined in the shared-mime-info
    Packit a7d494
    database. If the language definition file is not shipped by GtkSourceView, you
    Packit a7d494
    can also create the mimetype locally, usually in
    Packit a7d494
    ~/.local/share/mime/packages/.
    Packit a7d494

    Packit a7d494
    globs
    Packit a7d494

    Packit a7d494
    The semicolon-separated list of globs associated to the language.
    Packit a7d494

    Packit a7d494
    line-comment-start
    Packit a7d494

    Packit a7d494
    String used to create single-line comment in files of this type, e.g.
    Packit a7d494
    "#" in shell scripts.
    Packit a7d494
    It may be used in an editor to implement Comment/Uncomment functionality.
    Packit a7d494

    Packit a7d494
    block-comment-start
    Packit a7d494

    Packit a7d494
    String used to start block comment in files of this type, e.g. "/*" in C
    Packit a7d494
    files.
    Packit a7d494

    Packit a7d494
    block-comment-end
    Packit a7d494

    Packit a7d494
    String used to end block comment in files of this type, e.g. "*/" in C
    Packit a7d494
    files.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <styles>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    Contains the definitions of every style used in the current language and
    Packit a7d494
    their association with predefined styles in GtkSourceView.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements:
    Packit a7d494
    <style> (one or more).
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <style>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    Defines a style, associating its id with a user visible translatable
    Packit a7d494
    name and a default style.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements: none.
    Packit a7d494

    Packit a7d494
    Packit a7d494

    Attributes:

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    id (mandatory)

    Packit a7d494

    Packit a7d494
    Identifier for the style. This is used in the current language
    Packit a7d494
    to refer to this style and must be unique for the current document.
    Packit a7d494
    It can contain a string of letters, digits,
    Packit a7d494
    hyphens ("-") and underscores ("_").
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    name (mandatory)

    Packit a7d494

    Packit a7d494
    The user visible translatable name for the style. It has to be preceded
    Packit a7d494
    with a underscore ("_") to be marked for translation.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    map-to (optional)

    Packit a7d494

    Packit a7d494
    Used to map the style with a default style, to use colors and
    Packit a7d494
    font properties defined for those default styles.
    Packit a7d494
    The id of the default style has to be preceded with the id of the
    Packit a7d494
    language where it is defined, separated with a semicolon ":".
    Packit a7d494
    When omitted the style is not considered derived from any style and will
    Packit a7d494
    not be highlighted until the user specifies a color scheme for this
    Packit a7d494
    style.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <keyword-char-class>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    Contains a regex character class used to redefine the customizable
    Packit a7d494
    word boundary delimiters "\%[" and "\%]". This class is the set of character
    Packit a7d494
    that can be commonly found in a keyword.
    Packit a7d494
    If the element is omitted the two delimiters default to "\b".
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements: none.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <default-regex-options>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    Used to set global options for how regular expressions are processed.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements: none.
    Packit a7d494

    Packit a7d494
    Packit a7d494

    Attributes

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    case-sensitive (optional)

    Packit a7d494

    Set to false to make regular expressions

    Packit a7d494
    ignore case.
    Packit a7d494
    Defaults to true.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    extended (optional)

    Packit a7d494

    Setting this to true makes the regular

    Packit a7d494
    expression engine ignore spaces and comments. These comments start with
    Packit a7d494
    "#" and continue to the end of the line.
    Packit a7d494
    Defaults to false.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    dupnames (optional)

    Packit a7d494

    Setting this to true allows one to repeat an identifier

    Packit a7d494
    for capturing parentheses.  This is useful for some patterns that you
    Packit a7d494
    know only one instance of a named subpattern can ever be matched.
    Packit a7d494
    Defaults to false.
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <definitions>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    The element containing the real description of the syntax to be
    Packit a7d494
    highlighted. It contains one or more <context> element and an
    Packit a7d494
    arbitrary number of <define-regex> elements, interleaved.
    Packit a7d494
    It has no attributes.
    Packit a7d494
    Every contained element must have its id attribute set to an
    Packit a7d494
    identifier unique for the document. Exactly one of the contained
    Packit a7d494
    <context> element must have
    Packit a7d494
    the id attribute set to the id of the
    Packit a7d494
    <language> root element,
    Packit a7d494
    representing the initial context for the highlighting, the one the engine
    Packit a7d494
    enters at the beginning of the highlighted file.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    Contained elements:
    Packit a7d494
    <context> (one or more), <define-regex> (zero or more).
    Packit a7d494

    Packit a7d494
    Packit a7d494
    Packit a7d494

    Tag <define-regex>

    Packit a7d494
    Packit a7d494

    Packit a7d494
    The syntax highlighting engine of GtkSourceView uses
    Packit a7d494
    GRegex,
    Packit a7d494
    which uses the PCRE library. See the
    Packit a7d494
    Regular expression syntax
    Packit a7d494
    page in the GLib reference manual.
    Packit a7d494

    Packit a7d494

    Packit a7d494
    The <define-regex> tag defines a regular expression that can
    Packit a7d494
    be reused inside other regular expression, to avoid replicating common portions.
    Packit a7d494
    Those regular expressions are in the form /regex/options.  If there
    Packit a7d494
    are no options to be specified and you don't need to match the spaces at the
    Packit a7d494
    start and at the end of the regular expression, you can omit the slashes,
    Packit a7d494
    putting here only regex.  The possible options are those specified
    Packit a7d494
    above in the description of the <default-regex-options>
    Packit a7d494
    element. To disable a group of options, instead, you have to prepend an hyphen
    Packit a7d494
    - to them.  In GtkSourceView are also available some extensions to
    Packit a7d494
    the standard Perl style regular expressions:
    Packit a7d494

    Packit a7d494
      Packit a7d494
    • Packit a7d494
      \%[ and \%] are custom word boundaries, which can
      Packit a7d494
      be redefined with the <keyword-char-class> (in contrast with
      Packit a7d494
      \b);
      Packit a7d494

      Packit a7d494
    • Packit a7d494
      \%{id} will include the regular expression defined in another
      Packit a7d494
      <define-regex> element with the specified id.
      Packit a7d494

      Packit a7d494
      Packit a7d494

      Packit a7d494
      It is allowed to use any of the attributes from
      Packit a7d494
      <default-regex-options> as attributes of this tag.
      Packit a7d494

      Packit a7d494

      Packit a7d494
      Contained elements: none.
      Packit a7d494

      Packit a7d494
      Packit a7d494

      Attributes:

      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494

      id (mandatory)

      Packit a7d494

      Packit a7d494
      Identifier for the regular expression. This is used
      Packit a7d494
      for the inclusion of the defined regular expression and must be unique
      Packit a7d494
      for the current document. It can contain a string of letters, digits,
      Packit a7d494
      hyphens ("-") and underscores ("_").
      Packit a7d494

      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494
      Packit a7d494

      Tag <context>

      Packit a7d494
      Packit a7d494

      Packit a7d494
      This is the most important element when describing the syntax: the file to
      Packit a7d494
      be highlighted is partitioned in contexts representing the portions to be
      Packit a7d494
      colored differently. Contexts can also contain other contexts.
      Packit a7d494
      There are different kind of context elements: simple contexts, container
      Packit a7d494
      contexts, sub-pattern contexts, reference contexts and keyword contexts.
      Packit a7d494

      Packit a7d494

      Packit a7d494
      Context classes can be enabled or disabled for some contexts, with the
      Packit a7d494
      class and class-disabled attributes. You can create
      Packit a7d494
      your own context classes in custom language definition files. Here are the
      Packit a7d494
      default context classes:
      Packit a7d494

      Packit a7d494
        Packit a7d494
      • Packit a7d494
              comment: the context delimits a comment;
        Packit a7d494
            

        Packit a7d494
      • Packit a7d494
              no-spell-check: the context's content should
        Packit a7d494
              not be spell checked;
        Packit a7d494
            

        Packit a7d494
      • Packit a7d494
              path: the context delimits a path to a file;
        Packit a7d494
            

        Packit a7d494
      • Packit a7d494
              string: the context delimits a string.
        Packit a7d494
            

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Simple contexts

        Packit a7d494
        They contain a mandatory <match> element and an optional
        Packit a7d494
        <include> element. The context will span over the strings
        Packit a7d494
        matched by the regular expression contained in the <match>
        Packit a7d494
        element. In the <include> element you
        Packit a7d494
        can only put sub-pattern contexts.
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contained elements:
        Packit a7d494
        <match> (mandatory), <include> (optional).
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Attributes:

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        id (optional)

        Packit a7d494

        Packit a7d494
        A unique identifier for the context, used in references to the context. It
        Packit a7d494
        can contain a string of letters, digits, hyphens ("-") and
        Packit a7d494
        underscores ("_").
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        style-ref (optional)

        Packit a7d494

        Packit a7d494
        Highlighting style for this context. Value of this attribute
        Packit a7d494
        may be id of a style defined in current lang file, or id of a style
        Packit a7d494
        defined in other files prefixed with corresponding language id,
        Packit a7d494
        e.g. "def:comment".
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        extend-parent (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context has higher
        Packit a7d494
        priority than the end of its parent. If not specified it defaults to
        Packit a7d494
        true.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        end-parent (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context terminates parent context.
        Packit a7d494
        If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        first-line-only (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context can occur only
        Packit a7d494
        on the first line of buffer. If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        once-only (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context can occur only
        Packit a7d494
        once in its parent. If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to enable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class-disabled (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to disable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Container contexts

        Packit a7d494
        They contain a <start> element and an optional
        Packit a7d494
        <end>. They respectively contain the regular
        Packit a7d494
        expression that makes the engine enter in the context and the terminating one.
        Packit a7d494
        In the optional <include> element you can put contained
        Packit a7d494
        contexts of every type (simple, container, sub-pattern or reference).
        Packit a7d494
        If the <start> element is omitted, then the
        Packit a7d494
        id attribute and the <include> become
        Packit a7d494
        mandatory (the context can only be used as a container to include
        Packit a7d494
        its children).
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contained elements:
        Packit a7d494
        <start> (optional), <end> (optional), <include> (optional).
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Attributes:

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        id (mandatory only if <start> not present)

        Packit a7d494

        Packit a7d494
        A unique identifier for the context, used in references to the context. It
        Packit a7d494
        can contain a string of letters, digits, hyphens ("-") and
        Packit a7d494
        underscores ("_").
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        style-ref (optional)

        Packit a7d494

        Packit a7d494
        Highlighting style for this context. Value of this attribute
        Packit a7d494
        may be id of a style defined in current lang file, or id of a style
        Packit a7d494
        defined in other files prefixed with corresponding language id,
        Packit a7d494
        e.g. "def:comment".
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        style-inside (optional)

        Packit a7d494

        Packit a7d494
        If this attribute is "true", then the highlighting style will
        Packit a7d494
        be applied to the area between start and end matches; otherwise
        Packit a7d494
        whole context will be highlighted.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        extend-parent (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context has a higher
        Packit a7d494
        priority than the end of its parent. If not specified it defaults to
        Packit a7d494
        true.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        end-at-line-end (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context must be forced
        Packit a7d494
        to end at the end of the line. If not specified it defaults to
        Packit a7d494
        false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        end-parent (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context terminates parent context
        Packit a7d494
        when it ends.
        Packit a7d494
        If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        first-line-only (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context can start only
        Packit a7d494
        on the first line of buffer. If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        once-only (optional)

        Packit a7d494

        Packit a7d494
        A boolean value telling the engine whether the context can occur only
        Packit a7d494
        once in its parent. For a container context, it means that
        Packit a7d494
        each included context can occur once.
        Packit a7d494
        If not specified it defaults to false.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to enable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class-disabled (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to disable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Sub-pattern contexts

        Packit a7d494

        Packit a7d494
        They refer to a group in a regular expression of the parent context, so it
        Packit a7d494
        is possible to highlight differently only a portion of the matched regular
        Packit a7d494
        expression.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Attributes:

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        id (optional)

        Packit a7d494

        Packit a7d494
        A unique identifier for the context. It can contain a string of letters,
        Packit a7d494
        digits, hyphens ("-") and underscores ("_").
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        sub-pattern (mandatory)

        Packit a7d494

        Packit a7d494
        The sub-pattern to which we refer. "0" means the whole expression, "1" the
        Packit a7d494
        first group, "2" the second one, etc. If named sub-patterns are used you can
        Packit a7d494
        also use the name.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        where (mandatory only in container contexts)

        Packit a7d494

        Packit a7d494
        Can be "start" or "end". It has to be used
        Packit a7d494
        only if the parent is a container context to specify whether the
        Packit a7d494
        sub-pattern is in the regular
        Packit a7d494
        expression of the <start> or the <end>
        Packit a7d494
        element. In simple contexts it must be omitted.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to enable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        class-disabled (optional)

        Packit a7d494

        Packit a7d494
        A space-separated list of context classes to disable.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Reference contexts

        Packit a7d494

        Packit a7d494
        Used to include a previously defined context.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Attributes:

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        ref (mandatory)

        Packit a7d494

        Packit a7d494
        The id of the context to be included. A colon followed by an asterisk
        Packit a7d494
        (":*") at the end of the id means that the parent should include
        Packit a7d494
        every children of the specified context, instead of the context itself.
        Packit a7d494
        Prepending the id of another language to the id of the context (separated
        Packit a7d494
        with a semicolon ":") is possible to include contexts defined inside such
        Packit a7d494
        external language.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        style-ref (optional)

        Packit a7d494

        Packit a7d494
        Style in included context may be overridden by using this attribute.
        Packit a7d494
        Its value is id of the style to be used instead of style specified
        Packit a7d494
        in the referenced context.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        ignore-style (optional)

        Packit a7d494

        Packit a7d494
        If this attribute is "true" then the referenced context will not
        Packit a7d494
        be highlighted. It does not affect child contexts and their styles.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        original (optional)

        Packit a7d494

        Packit a7d494
        If this attribute is "true", it references the original context, if it
        Packit a7d494
        has been replaced with the <replace> tag.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Keyword contexts

        Packit a7d494

        Packit a7d494
        They contain a list of <keyword> and matches every keyword
        Packit a7d494
        listed. You can also put a <prefix> and/or a
        Packit a7d494
        <suffix> common to every keyword.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Note that keywords are matched in the order they are listed, so if you
        Packit a7d494
        have both a keyword "foo" and a keyword "foobar", you should always list
        Packit a7d494
        foobar before foo, or it will never be matched.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements:
        Packit a7d494
        <prefix> (optional), <suffix> (optional), <keyword> (one or more).
        Packit a7d494

        Packit a7d494

        Packit a7d494
        The attributes are the same used in simple contexts. If the
        Packit a7d494
        once-only attribute is true, it means that
        Packit a7d494
        each keyword can occur once.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <include>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains the list of context contained in the current
        Packit a7d494
        <context>.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements:
        Packit a7d494
        <context> (one or more), <define-regex> (zero or more).
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <match>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains the regular expression for the current simple context.
        Packit a7d494
        The expression is in the same form used in
        Packit a7d494
        <define-regex> elements.
        Packit a7d494
        It is allowed to use any of the attributes from
        Packit a7d494
        <default-regex-options> as attributes of this tag.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <start>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains the starting regular expression for the current container context.
        Packit a7d494
        The expression is in the same form used in <define-regex>
        Packit a7d494
        elements.
        Packit a7d494
        It is allowed to use any of the attributes from
        Packit a7d494
        <default-regex-options> as attributes of this tag.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <end>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains the terminating regular expression for the current container
        Packit a7d494
        context. The expression is in the same form used in <define-regex>
        Packit a7d494
        elements, with an extension: \%{sub-pattern@start} will be
        Packit a7d494
        substituted with the string matched in the corresponding sub-pattern
        Packit a7d494
        (can be a number or a name if named sub-patterns are used) in the
        Packit a7d494
        preceding <start> element. For instance you could
        Packit a7d494
        implement shell-style here-documents with this code:
        Packit a7d494

        Packit a7d494
        Packit a7d494
        <context id="here-doc">
        Packit a7d494
            <start>&lt;&lt;\s*(\S+)$</start>
        Packit a7d494
            <end>^\%{1@start}$</end>
        Packit a7d494
        </context>
        Packit a7d494
        Packit a7d494

        Packit a7d494
        It is also possible to use any of the attributes from
        Packit a7d494
        <default-regex-options> as attributes of this tag.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <keyword>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains a keyword to be matched by the current context. The keyword is a
        Packit a7d494
        regular expression in the form used in <define-regex>.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <prefix>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains a prefix common to all of the following keywords in the current
        Packit a7d494
        context. The prefix is a regular expression in the form used in
        Packit a7d494
        <define-regex>. If not specified it defaults to
        Packit a7d494
        \%[
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <suffix>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        Contains a suffix common to all of the following keywords in the current
        Packit a7d494
        context. The suffix is a regular expression in the form used in
        Packit a7d494
        <define-regex>. If not specified it defaults to
        Packit a7d494
        \%]
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        Tag <replace>

        Packit a7d494
        Packit a7d494

        Packit a7d494
        The replace tag allows you to change one context so it functions as
        Packit a7d494
        another context.  For example, in the html.lang definition,
        Packit a7d494
        there are a few references to a null context with id
        Packit a7d494
        "embedded-lang-hook".  In php.lang, that context is
        Packit a7d494
        replaced like this: <replace id="html:embedded-lang-hook"
        Packit a7d494
        ref="php-block">, so that php blocks are recognized within the
        Packit a7d494
        html:html context at the points where the
        Packit a7d494
        embedded-lang-hook context appears.
        Packit a7d494

        Packit a7d494

        Packit a7d494
        Contained elements: none.
        Packit a7d494

        Packit a7d494
        Packit a7d494

        Attributes:

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        id (mandatory)

        Packit a7d494

        Packit a7d494
        The id of the context to replace. Ex: id="html:embedded-lang-hook"
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494

        ref (mandatory)

        Packit a7d494

        Packit a7d494
        The id of the context to put in place of the context being replaced. Ex: ref="php-block"
        Packit a7d494

        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494
        Packit a7d494

        Generated by GTK-Doc V1.28.1
        Packit a7d494
        </body>
        Packit a7d494
        </html>