From: nisikimi Date: Thu, 4 Mar 2010 04:33:07 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: XML-AFTER-XEX X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4158fec4534f4c554c51a94827eeed409bf1655e;p=m17n%2Fm17n-db.git *** empty log message *** --- diff --git a/MIM/expr.rnc b/MIM/expr.rnc new file mode 100644 index 0000000..5b5498c --- /dev/null +++ b/MIM/expr.rnc @@ -0,0 +1,175 @@ +default namespace = "http://www.m17n.org/MIM" +namespace xi = "http://www.w3.org/1999/XML/xinclude" + +start |= expr +expr = defun | defmacro | defvar | term +term |= integer | \string | symbol | \list | error | varref | funcall +defun = + element defun { + attribute fname { xsd:ID }, + (args)?, + term* + } +defmacro = + element defmacro { + attribute fname { xsd:ID }, + (args)?, + term* + } +args = + element args { + element fixed { + attribute vname { xsd:Name } + }*, + element optional { + attribute vname { xsd:Name } + }*, + element rest { + attribute vname { xsd:Name } + }* + } +defvar = + element defvar { + attribute vname { xsd:ID }, + description?, + ((integer, + element possible-value { + (integer + | element range { integer, integer })+ + }?) + | (\string, + element possible-value { \string+ }?) + | (symbol, + element possible-value { symbol+ }?))? + } +description = + element description { + element gettext { text } + | text + } +integer = + element integer { + xsd:integer + | xsd:string { pattern = "\?." } + | xsd:string { pattern = "[0#]x[0-9A-F]{1,6}" } + } +\string = element string { xsd:string } +symbol = element symbol { xsd:string } +\list = element list { term* } +error = + element error { + attribute ename { xsd:Name }?, + \string + } +varref = + element varref { + attribute vname { xsd:Name }, + empty + } +funcall = + element funcall { + attribute fname { xsd:IDREF }, + term* + } + | predefined +predefined = + element set { + attribute vname { xsd:Name }, + term + } + | element and { term+ } + | element or { term+ } + | element not { term } + | element eq { term+ } + | element noteq { term, term } + | element equal { term, term } + | element match { term, term } + | element lt { intterm, intterm } + | element le { intterm, intterm } + | element ge { intterm, intterm } + | element gt { intterm, intterm } + | element add { + attribute vname { text }?, + intterm+ + } + | element sub { + attribute vname { text }?, + intterm+ + } + | element mul { + attribute vname { text }?, + intterm+ + } + | element div { + attribute vname { text }?, + intterm+ + } + | element mod { + (attribute vname { text }, + intterm) + | (intterm, intterm) + } + | element logand { + attribute vname { text }?, + intterm+ + } + | element logior { + attribute vname { text }?, + intterm+ + } + | element logxor { + attribute vname { text }?, + intterm+ + } + | element lsh { + (attribute vname { text }, + intterm) + | (intterm, intterm) + } + | element append { + attribute vname { text }?, + term+ + } + | element concat { + attribute vname { text }?, + (intterm | strterm | listterm)+ + } + | element length { strterm | listterm } + | element nth { intterm, (strterm | listterm) } + | element copy { listterm } + | element ins { + attribute vname { text }, + intterm, + (strterm | listterm) + } + | element del { + attribute vname { text }, + intterm, + intterm + } + | element progn { term* } + | element if { term, term, term? } + | element when { term+ } + | element cond { \list+ } + | element loop { term+ } + | element while { term+ } + | element foreach { + attribute vname { text }, + (strterm | listterm), + term+ + } + | element break { term? } + | element return { term? } + | element catch { + attribute vname { xsd:Name }?, + (symbol | error), + term+ + } + | element throw { (symbol, term?) | error } + | element quote { term } + | element eval { term } + | element type { term } +intterm |= varref | integer | funcall +strterm = varref | \string | funcall +symterm = varref | symbol | funcall +listterm = varref | \list | funcall diff --git a/MIM/expr.rng b/MIM/expr.rng new file mode 100644 index 0000000..75c9857 --- /dev/null +++ b/MIM/expr.rng @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \?. + [0#]x[0-9a-fA-F]{1,6} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MIM/mim.rnc b/MIM/mim.rnc new file mode 100644 index 0000000..297abb8 --- /dev/null +++ b/MIM/mim.rnc @@ -0,0 +1,125 @@ +default namespace = "http://www.m17n.org/MIM" +namespace xi = "http://www.w3.org/1999/XML/xinclude" + +include "expr.rnc" +start |= + element input-method { + im-declaration, + description?, + element title { xsd:string }?, + variable-list?, + command-list?, + module-list?, + macro-list?, + map-list?, + state-list? + } +# =====input method details==================================== +im-declaration = + element tags { + element language { + "t" + | xsd:string { pattern = "[a-z]{2,3}" } + }, + ((element name { "nil" }, + element extra-id { xsd:ID }) + | (element name { + xsd:string { pattern = "[^n][^i][^l]" } + | xsd:string { pattern = ".{1,2}" } + | xsd:string { pattern = "....+" } + }, + element extra-id { xsd:ID }?)) + }, + element m17n-version { + xsd:string { pattern = "[0-9]+\.[0-9]+\.[0-9]+" } + }? +# setups +variable-list = element variable-list { defvar+ } +command-list = + element command-list { + element defcmd { + attribute cname { + xsd:ID { pattern = "command-.*" } + }, + description?, + keyseq* + }+ + } +module-list = + element module-list { + element module { + attribute id { xsd:string }, + element defun { + attribute fname { + xsd:ID { pattern = ".*-function-.*" } + }, + empty + }+ + }+ + } +macro-list = element macro-list { defun+ } +# the real work +map-list = + element map-list { + element map { + attribute mname { + xsd:ID { pattern = "map-.*" } + }, + element rule { (keyseq | command-reference), funcall* }* + }+ + } +command-reference = + element command { + attribute cname { xsd:IDREF } + } +keyseq = element keyseq { (listterm | strterm)+ } +marker = element marker { xsd:string } +selector = + element selector { + "@first" + | "@current" + | "@last" + | "@previous" + | "@next" + | "@previous-candidate-change" + | "@next-candidate-change" + } +state-list = + element state-list { + element state { + attribute sname { + xsd:ID { pattern = "state-.*" } + }, + element title { xsd:string }?, + (element state-hook { funcall+ }? + & element catch-all-branch { funcall* }? + & element branch { + attribute mname { xsd:IDREF }, + funcall* + }*) + }* + } +# ===MIM original terms and functions ====================================== +keyseqterm = keyseq | funcall | varref +markerterm = marker | funcall | varref +selectorterm = selector | funcall | varref +term |= keyseq | marker | selector +funcall |= + element insert { intterm | strterm } + | element insert-candidates { (listterm | strterm)+ } + | element delete { markerterm | intterm } + | element select { selectorterm | intterm } + | element show-candidates { empty } + | element hide-candidates { empty } + | element move { markerterm | intterm } + | element mark { markerterm } + | element pushback { keyseqterm | intterm } + | element pop { empty } + | element undo { intterm? } + | element commit { empty } + | element unhandle { empty } + | element shift { symterm } + | element shiftback { empty } + | element char-at { markerterm } + | element key-count { empty } + | element surrounding-text-flag { empty }