mv.modes

1 Overview

The file <glossdir>/mv/xml/mv.modes contains modes to generate mv and modes files in GLOSS. It is an extension module for xml.modes. It is generated from mv.modes.gloss (using modes.mv, mv.modes and xml.modes of course). Further documentation will be forthcoming, either in <glossdir>/doc (for general documentation) or here (for more technical stuff).

2 The code

!declare-prefix @prefix[modes] @uri[http://gloss.bham.ac.uk/mv/xml/modes] {
!declare-prefix @prefix[xml] @uri[http://gloss.bham.ac.uk/mv/xml/xml] {

!init-parameter @name[modes:nsprefix] @value[mv]

![ xml:bom: don't output the bom ]
!init-parameter @name[xml:bom] @value[omit]
![ xml:decl: include an xml declaration ]
!init-parameter @name[xml:decl] @value[include]
![ xml:version: XML version 1.0 ]
!init-parameter @name[xml:version] @value[1.0]
![ xml:encoding: use UTF-8 by default ]
!init-parameter @name[xml:encoding] @value[UTF-8]

!mode @name[modes:doctype] @accept[] @type[process]
  !hook @mode[xml:doctype] @action[process]
  !default
    !doctype @system[http$://gloss.bham.ac.uk/dtd/mv/modularvocab.dtd]
    !return

!mode @name[modes:modes] @accept[] @type[process]
  !default 
    !set-parameter @name[\{http$://gloss.bham.ac.uk/mv/xmlnamespaces\}$\{modes:nsprefix\}] 
      @value[http$://gloss.bham.ac.uk/xmlns/modularvocab]    
    !process-tokens @mode[xml:document-fragment] 
      !set-parameter @name[xml:inner-document-fragment-mode] @value[modes:top-level]
    !return

!mode @name[modes:mv] @accept[] @type[process]
  !default
    !set-parameter @name[\{http$://gloss.bham.ac.uk/mv/xmlnamespaces\}$\{modes:nsprefix\}] 
      @value[http$://gloss.bham.ac.uk/xmlns/modularvocab]
    !process-tokens @mode[xml:document]

!mode @name[modes:root] @accept[] @type[process]
  !hook @mode[xml:root] @action[process]  
  !default
    !element @name[$\{modes:nsprefix\}$:modularvocab]
      !process-tokens @mode[modes:modules] 
      !process-tokens @mode[modes:top-level] 

!mode @name[modes:structured-content] @type[process] 
  @accept[elt|attr|pi|cref|eref|pdef|pref|!CDATA|!LITERAL|pelt|!|\{|\}|\[|\]] 
  !hook @mode[xml:structured-content] @action[process]
  !punc @data[\{] 
    !execute @mode[xml:brace-group] 
      !set-parameter @name[xml:inner-structured-content] @value[modes:structured-content]
  !punc @data[\}]
    !abort
  !punc @data[\[] 
    !execute @mode[xml:text]
      !set-parameter @name[xml:inner-structured-content] @value[modes:structured-content]
  !punc @data[\]]
    !abort
  !pdef
    !element @name[$\{modes:nsprefix\}$:set-parameter]
      !attribute @name[name] [$q]
      !attribute @name[value] [$v]
  !pref
    !element @name[$\{modes:nsprefix\}$:text]
      !text [$$\{$q\}]
  !pelt @fullname[xinclude]
    !element @name[xi$:include] @ns[http$://www.w3.org/2001/XInclude]
      !process-tokens @mode[xml:attribute-list]
  !pelt @prefix[]
    !element @name[$\{modes:nsprefix\}$:$n]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !include @mode[xml:structured-content] @hook[process]

!mode @name[modes:top-level] @accept[pi|eref|!LITERAL|pelt|!|\{|\}] @type[process]
  !punc @data[\{] 
    !execute @mode[xml:brace-group] 
      !set-parameter @name[xml:inner-structured-content] @value[modes:top-level]
  !punc @data[\}]
    !abort
  !punc @data[\[] 
    !execute @mode[xml:text]
      !set-parameter @name[xml:inner-structured-content] @value[modes:top-level]
  !punc @data[\]]
    !abort
  !pelt @data[declare-prefix]
    !element @name[$\{modes:nsprefix\}$:declare-prefix]
      !text &#x0A;
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[modes:top-level]
    !text &#x0A;
  !pelt @data[mode]
    !element @name[$\{modes:nsprefix\}$:mode]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[modes:mode-content]
    !text &#x0A;
  !include @mode[modes:structured-content]

!mode @name[modes:mode-content] @type[process]
  @accept[pelt|attr|pi|cref|eref|b64|char|fp|hex|int|pdef|pref|str|uri|elt|!CDATA|!LITERAL|!|\{|\}|\[|\]|ns]
  !pelt @data[$match||default||include||hook]
    !element @name[$\{modes:nsprefix\}$:$n]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !pelt @data[$b64||char||fp||str||uri||uc||int||hex||pdef||pref||elt||pelt||attr||pi||cref||eref||punc]
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [$n]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !b64 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [b64]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !char 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [char]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !cref 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [cref]
      !attribute @name[fullname] [$q]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !elt 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [elt]
      !attribute @name[fullname] [$q]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !eref 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [eref]
      !attribute @name[fullname] [$q]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !fp 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [fp]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !hex 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [hex]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !int 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [int]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !pdef 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [pdef]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !pref 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [pref]
      !attribute @name[fullname] [$q]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !pi 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [pi]
      !attribute @name[fullname] [$q]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !str 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [str]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !uri 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [uri]
      !attribute @name[data] [$d]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !uc 
    !element @name[$\{modes:nsprefix\}$:match]
      !attribute @name[type] [uc]
      !attribute @name[value] [$v]
      !process-tokens @mode[xml:attribute-list]
      !process-tokens @mode[xml:structured-content]
  !include @mode[xml:structured-content]

!mode @name[modes:cr] @accept[] @use-indentation[false] @type[execute]
  !default 
    !literal [[&#x0A;]]
    !return

}; !declare-prefix
}; !declare-prefix

This file is part of the GLOSS system, Copyright Richard Kaye http://gloss.bham.ac.uk/. Usage permitted under the GPL. No Warranty.

This page is copyright. Web page design and creation by GLOSS.