From bfa492bb211146528ba50199540fbd186ce9d4c3 Mon Sep 17 00:00:00 2001 From: LdBeth Date: Mon, 21 Aug 2023 00:35:46 -0500 Subject: [PATCH] new rnc-ts-mode --- core/rnc-mode.el | 174 --------------------------------- core/rnc-ts-mode.el | 154 +++++++++++++++++++++++++++++ schema/lsml.rnc | 156 +++++++++++++++--------------- schema/rss.rnc | 203 ++++++++++++++++++++------------------- schema/symbulatordoc.rnc | 2 +- schema/texml.rnc | 79 ++++++++------- 6 files changed, 381 insertions(+), 387 deletions(-) delete mode 100644 core/rnc-mode.el create mode 100644 core/rnc-ts-mode.el diff --git a/core/rnc-mode.el b/core/rnc-mode.el deleted file mode 100644 index 2959c07..0000000 --- a/core/rnc-mode.el +++ /dev/null @@ -1,174 +0,0 @@ -;;; rnc-mode.el --- Emacs mode to edit Relax-NG Compact files -*- lexical-binding:t -*- - -;; Copyright (C) 1994-1998, 2001-2022 Free Software Foundation, Inc. - -;; Author: Stefan Monnier -;; Keywords: xml relaxng -;; Version: 0.3 - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - - -;;; Commentary: - -(require 'smie) -(require 'nxml-mode) - -;;; Code: - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.rnc\\'" . rnc-mode)) - -(defconst rnc-mode-syntax-table - (let ((st (make-syntax-table))) - (modify-syntax-entry ?# "<" st) - (modify-syntax-entry ?\n ">" st) - (modify-syntax-entry ?\" "\"" st) - (modify-syntax-entry ?\' "\"" st) - (modify-syntax-entry ?- "_" st) - (modify-syntax-entry ?. "_" st) - (modify-syntax-entry ?: "_" st) - (modify-syntax-entry ?_ "_" st) - st)) - -(defconst rnc--keywords - ;; Taken from the grammar in http://relaxng.org/compact-20021121.html, - ;; by order of appearance. - '("namespace" "default" "datatypes" "element" "attribute" - "list" "mixed" "parent" "empty" "text" "notAllowed" "external" - "grammar" "div" "include" ;; "start" - "string" "token" "inherit")) - -(defconst rnc--def-regexp "^[ \t]*\\([\\[:alpha:]][[:alnum:]-._]*\\)[ \t]*=") - -(defconst rnc-font-lock-keywords - `((,rnc--def-regexp (1 font-lock-function-name-face)) - (,(concat "\\_<" (regexp-opt rnc--keywords) "\\_>") - (0 font-lock-keyword-face)) - ("attribute[ \t\n]+\\([^ ]+\\)" (1 'nxml-attribute-local-name)) - ;; FIXME: We'd like to use nxml-element-local-name for element names, - ;; but by default this looks exactly like font-lock-function-name-face, - ;; which we want to use for local pattern definitions. - ;; ("element[ \t\n]+\\([^ ]+\\)" (1 'nxml-element-local-name)) - )) - -(defconst rnc-imenu-generic-expression `((nil ,rnc--def-regexp 1))) - -(defconst rnc-smie-grammar - ;; The body of an RNC file is a sequence of definitions. - ;; Problem is: these definitions are not separated by any special keyword. - ;; It's basically a repetition of (id "=" pattern), where - ;; patterns can end with: - ;; "}", ")" "*", "+", "?", id, stringliteral - ;; Since this is way beyond the power of SMIE, we resort to using a pseudo - ;; " ; " separator which is introduced by the tokenizer. - (smie-prec2->grammar - (smie-bnf->prec2 - '((id) (atom) (args) - (annota (id "[" args "]")) - (header (header "include" atom)) - (decls (id "=" pattern) (id "|=" pattern) (id "&=" pattern) - (decls " ; " decls)) - (pattern ("element" args) ("attribute" args) - ("list" args) ("mixed" args) - ("parent" id) ("external" id) - ("grammar" atom) - ("{" pattern "}") - (annota patterm) - (pattern "," pattern) - (pattern "&" pattern) - (pattern "|" pattern) - (pattern "?") - (pattern "*") - (pattern "+"))) - ;; The spec says "There is no notion of operator precedence". - '((assoc " ; ")) - '((assoc "," "&" "|") (nonassoc "?" "*" "+")) - ))) - -(defconst rnc-smie--def-regexp - (concat "\\(?:\\(?:\\(default[ \t\n]+\\)?namespace\\|datatypes\\)[ \t\n]+\\)?" - "\\(?:\\s_\\|\\sw\\)+[ \t\n]*[|&]?=") - "Regexp matching a \"definition\". -Any line that starts with this is presumed to start a new definition, -so the preceding newline is turned into an implicit \" ; \" token.") - -(defun rnc-smie-forward-token () - (let ((start (point))) - (forward-comment (point-max)) - (if (and (> (point) start) - (looking-at rnc-smie--def-regexp) - (save-excursion - (goto-char start) - (forward-comment -1) - (= (point) start))) - " ; " - (if (looking-at "\\s.") - (buffer-substring-no-properties - (point) - (progn (forward-char 1) - (point))) - (smie-default-forward-token))))) - -(defun rnc-smie-backward-token () - (let ((start (point))) - (forward-comment (- (point))) - (if (and (< (point) start) - (let ((pos (point))) - (goto-char start) - (prog1 - (looking-at rnc-smie--def-regexp) - (goto-char pos)))) - " ; " - (if (looking-back "\\s." (1- (point))) - (buffer-substring-no-properties - (point) - (progn (forward-char -1) - (point))) - (smie-default-backward-token))))) - -(defun rnc-smie-rules (kind token) - (pcase (cons kind token) - (`(:list-intro . "element") t) - (`(:elem . empty-line-token) " ; ") - (`(:before . ,(or "include" "default" "namespace" "datatypes")) 0) - (`(:before . "{") - (save-excursion - (let ((offset (if (smie-rule-bolp) smie-indent-basic 0)) - x) - (while (or (null (car-safe x)) - (integerp (car-safe x))) - (setq x (smie-backward-sexp 'halfsexp))) - (goto-char (nth 1 x)) - `(column . ,(+ (smie-indent-virtual) offset))))) - (`(:after . ,(or "=" "|=" "&=")) smie-indent-basic) - (`(:before . ,(or "|" "&" ",")) - (and (smie-rule-bolp) (smie-rule-parent-p "(" "{") (smie-rule-parent))) - (`(,_ . " ; ") (smie-rule-separator kind)) - )) - -;;;###autoload -(define-derived-mode rnc-mode prog-mode "RNC" - "Major mode to edit Relax-NG Compact files." - (setq-local comment-start "#") - (setq-local font-lock-defaults '(rnc-font-lock-keywords)) - (setq-local imenu-generic-expression rnc-imenu-generic-expression) - (smie-setup rnc-smie-grammar #'rnc-smie-rules - :forward-token #'rnc-smie-forward-token - :backward-token #'rnc-smie-backward-token)) - -(provide 'rnc-mode) -;;; rnc-mode.el ends here diff --git a/core/rnc-ts-mode.el b/core/rnc-ts-mode.el new file mode 100644 index 0000000..40d275e --- /dev/null +++ b/core/rnc-ts-mode.el @@ -0,0 +1,154 @@ +;;; rnc-ts-mode.el --- Emacs mode to edit Relax-NG Compact files -*- lexical-binding:t -*- + +;; Copyright (C) 2023 LdBeth + +;; Author: LdBeth +;; Keywords: xml relaxng +;; Version: 0.3 + +;; This file is not part of GNU Emacs. + +;; rnc-ts-mode is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; rnc-ts-mode is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + + +;;; Commentary: + +(require 'nxml-mode) +(require 'treesit) +(eval-when-compile + (require 'rx)) + +;;; Code: + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.rnc\\'" . rnc-ts-mode)) + +(defconst rnc-mode-syntax-table + (let ((st (make-syntax-table))) + (modify-syntax-entry ?# "<" st) + (modify-syntax-entry ?\n ">" st) + (modify-syntax-entry ?\" "\"" st) + (modify-syntax-entry ?\' "\"" st) + (modify-syntax-entry ?- "_" st) + (modify-syntax-entry ?. "_" st) + (modify-syntax-entry ?: "_" st) + (modify-syntax-entry ?_ "_" st) + st)) + +(defconst rnc--keywords + ;; Taken from the grammar in http://relaxng.org/compact-20021121.html, + ;; by order of appearance. + '("namespace" "default" "datatypes" "element" "attribute" + "list" "mixed" "parent" "empty" "text" "notAllowed" "external" + "grammar" "div" "include" ;; "start" + "string" "token" "inherit")) + +(defconst rnc--operators + '("=" "&=" "|=" "*" "?" "+" "-" "~")) + +(defconst rnc--delimiters '("&" "," "|")) + +(defconst rnc--def-regexp "^[ \t]*\\([\\[:alpha:]][[:alnum:]-._]*\\)[ \t]*=") + +(defvar rnc-indent-level 2) + +(defvar rnc--treesit-font-lock-settings + (treesit-font-lock-rules + + :language 'rnc + :feature 'comment + '((comment) @font-lock-comment-face) + + :language 'rnc + :feature 'keyword + `([,@rnc--keywords] @font-lock-keyword-face) + + :language 'rnc + :feature 'string + '((literal_segment) @font-lock-string-face) + + :language 'rnc + :feature 'definition + '((define + name: (identifier) @font-lock-function-name-face) + + (param + name: (identifier) @font-lock-variable-name-face)) + + :language 'rnc + :feature 'namespace + '((declare + name: (identifier) @font-lock-constant-face) + (name + ns: (prefix) @font-lock-constant-face) + (datatype_name + ns: (prefix) @font-lock-constant-face)) + + :language 'rnc + :feature 'docstring + '((documentations) @font-lock-doc-face) + + :language 'rnc + :feature 'operator + `([,@rnc--operators] @font-lock-operator-face) + + :language 'rnc + :feature 'bracket + '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) + + :language 'rnc + :feature 'delimiter + `(([,@rnc--delimiters]) @font-lock-delimiter-face))) + +(defvar rnc--treesit-indent-rules + `((rnc + ((parent-is "declare") parent-bol 0) + ((node-is "}") parent-bol 0) + ((node-is ")") parent-bol 0) + ((node-is "]") parent-bol 0) + ((node-is "literal_segment") parent-bol 0) + ((parent-is "comment") prev-adaptive-prefix 0) + ((parent-is ,(rx (seq (one-or-more alpha) "_pattern"))) first-sibling 0) + ((parent-is ,(rx (seq (one-or-more alpha) "_block"))) parent-bol rnc-indent-level) + ((parent-is "param") great-grand-parent rnc-indent-level) + ((field-is "body") parent-bol rnc-indent-level) + ))) + +(defun rnc--treesit-defun-name (node) + "Return the defun name of NODE. +Return nil if there is no name or if NODE is not a defun node." + (treesit-node-text + (treesit-node-child-by-field-name + node + "name") + t)) + +;;;###autoload +(define-derived-mode rnc-ts-mode prog-mode "RNC" + "Major mode to edit Relax-NG Compact files." + (when (treesit-ready-p 'rnc) + (setq-local comment-start "#") + (treesit-parser-create 'rnc) + (setq-local treesit-font-lock-settings rnc--treesit-font-lock-settings) + (setq-local treesit-font-lock-feature-list + '((comment definition) + (keyword string) + (bracket delimiter operator docstring namespace))) + (setq-local reesit-defun-name-function #'rnc--treesit-defun-name) + (setq-local treesit-simple-indent-rules rnc--treesit-indent-rules) + (treesit-major-mode-setup))) + + +(provide 'rnc-ts-mode) +;;; rnc-ts-mode.el ends here diff --git a/schema/lsml.rnc b/schema/lsml.rnc index 0830633..aa5733c 100644 --- a/schema/lsml.rnc +++ b/schema/lsml.rnc @@ -9,124 +9,124 @@ namespace html = "http://www.w3.org/1999/xhtml" start = lsmlElement lsmlElement = - element lsml { - (attribute version { "0.1" } & - attribute lang { xsd:language }? & - attribute format { "htmlonly" | "usetext" }?), - lsmlClient, - lsmlHeader, - lsmlBody, - lsmlSignature? - } + element lsml { + (attribute version { "0.1" } & + attribute lang { xsd:language }? & + attribute format { "htmlonly" | "usetext" }?), + lsmlClient, + lsmlHeader, + lsmlBody, + lsmlSignature? + } lsmlClient = - element config { - element usetext { empty }?, - element headers { attribute * { text }* }, - element mime { - element item { - attribute cid { text }, - attribute src { xsd:anyURI } - }* - } - }? + element config { + element usetext { empty }?, + element headers { attribute * { text }* }, + element mime { + element item { + attribute cid { text }, + attribute src { xsd:anyURI } + }* + } + }? lsmlHeader = - element head { - lsmlEmailHds, - lsmlPrev?, - lsmlRaw* - } + element head { + lsmlEmailHds, + lsmlPrev?, + lsmlRaw* + } lsmlPrev = element preview { text } lsmlEmailHds = - element Subject { text } & - element To { lsmlEmail+ }? & - element From { lsmlEmail }? & - element Cc { lsmlEmail+ }? & - element Bcc { lsmlEmail+ }? & - element headers { - (element * { text })+ - }? + element Subject { text } & + element To { lsmlEmail+ }? & + element From { lsmlEmail }? & + element Cc { lsmlEmail+ }? & + element Bcc { lsmlEmail+ }? & + element headers { + (element * { text })+ + }? email.string = - xsd:string { pattern = ".+@.+" } + xsd:string { pattern = ".+@.+" } lsmlEmail = - element name { text }?, element email { email.string } + element name { text }?, element email { email.string } rfc2392.cid = - xsd:string { pattern = "cid:.+" } + xsd:string { pattern = "cid:.+" } lsmlImage = - element img { - attribute alt { text } & - attribute src { xsd:anyURI | rfc2392.cid } & - attribute width { xsd:unsignedInt }? & - attribute height { xsd:unsignedInt }? - } + element img { + attribute alt { text } & + attribute src { xsd:anyURI | rfc2392.cid } & + attribute width { xsd:unsignedInt }? & + attribute height { xsd:unsignedInt }? + } lsmlAnyAttribute = attribute * { text } lsmlAnyHTML = - (text | - element html:* { - (lsmlAnyAttribute | text | lsmlAnyHTML)* - })+ + (text | + element html:* { + (lsmlAnyAttribute | text | lsmlAnyHTML)* + })+ lsmlBody = element body { lsmlTopElements+ } lsmlTopElements = - (lsmlCodeBlk | lsmlQuote | - lsmlList | lsmlRule | - lsmlPara | lsmlImage | lsmlSection | lsmlRaw) + (lsmlCodeBlk | lsmlQuote | + lsmlList | lsmlRule | + lsmlPara | lsmlImage | lsmlSection | lsmlRaw) lsmlCodeBlk = - element code { - attribute lang { text }?, - (text | lsmlDiff)* - } + element code { + attribute lang { text }?, + (text | lsmlDiff)* + } lsmlQuote = - element quote { - lsmlQuoteAttrs, - (lsmlTopElements+ | lsmlAnyHTML) - } | element vquote { text } + element quote { + lsmlQuoteAttrs, + (lsmlTopElements+ | lsmlAnyHTML) + } | element vquote { text } rfc822.date = - xsd:string { pattern = - "(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), )?\d{1,2} ((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) \d{4} \d{2}:\d{2}(:\d{2})? ((UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|([\+\-]\d{4}))" -} + xsd:string { pattern = + "(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), )?\d{1,2} ((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) \d{4} \d{2}:\d{2}(:\d{2})? ((UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|([\+\-]\d{4}))" + } rfc2392.mid = xsd:string { pattern = "mid:.+" } lsmlQuoteAttrs = - attribute from { text }? & - attribute date { rfc822.date }? & - attribute cite { rfc2392.mid }? + attribute from { text }? & + attribute date { rfc822.date }? & + attribute cite { rfc2392.mid }? lsmlList = - element l { - lsmlListAttrs, - lsmlListEl+ - } + element l { + lsmlListAttrs, + lsmlListEl+ + } lsmlListEl = element o { lsmlText | lsmlList } lsmlListAttrs = attribute type { "ord" | "unord" }? lsmlRaw = - element raw { - (attribute alt { text } | element alt { text } )?, - lsmlAnyHTML - } + element raw { + (attribute alt { text } | element alt { text } )?, + lsmlAnyHTML + } lsmlRule = element hr { empty } lsmlSection = - element section { - lsmlSecTitle?, - lsmlTopElements+ - } + element section { + lsmlSecTitle?, + lsmlTopElements+ + } lsmlSecTitle = - element title { - attribute level { "h1" | "h2" | "h3" | "h4" | "h5" | "h6" }?, - lsmlText - } + element title { + attribute level { "h1" | "h2" | "h3" | "h4" | "h5" | "h6" }?, + lsmlText + } lsmlText = mixed { (lsmlInline | lsmlDiff | lsmlBr | lsmlRaw)* } lsmlBr = element br { empty } diff --git a/schema/rss.rnc b/schema/rss.rnc index feac225..ab16285 100644 --- a/schema/rss.rnc +++ b/schema/rss.rnc @@ -7,43 +7,50 @@ namespace atom = "http://www.w3.org/2005/Atom" start = rss.element rss.element = - element rss { - (attribute version { "2.0" } & - extension.atts), - channel.element - } + element rss { + (attribute version { "2.0" } & + extension.atts), + channel.element + } extension.atts = attribute * { text }* channel.element = - element channel { - title.element & - link.element & - description.element & - atom.link.element+ & - generator.element? & - language.element? & - copyright.element? & - managing-editor.element? & - webmaster.element? & - pubdate.element? & - category.element? & - last-build-date.element? & - docs.element? & - cloud.element? & - ttl.element? & - image.element? & - rating.element? & - text-input.element? & - skipHours.element? & - skipDays.element? & - item.element* - } + element channel { + title.element & + link.element & + description.element & + atom.link.element+ & + generator.element? & + language.element? & + copyright.element? & + managing-editor.element? & + webmaster.element? & + pubdate.element? & + category.element? & + last-build-date.element? & + docs.element? & + cloud.element? & + ttl.element? & + image.element? & + rating.element? & + text-input.element? & + skipHours.element? & + skipDays.element? & + item.element* + } email.string = - xsd:string { minLength = "6" maxLength = "127" pattern = "[^\s@]+@[^\s@]+\.[^\s@]{2,} \(([^\s]\s)*[^\s]+\)" } + xsd:string { + minLength = "6" + maxLength = "127" + pattern = "[^\s@]+@[^\s@]+\.[^\s@]{2,} \(([^\s]\s)*[^\s]+\)" + } rfc822.date = - xsd:string { pattern = - "(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), )?\d{1,2} ((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) \d{4} \d{2}:\d{2}(:\d{2})? ((UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|([\+\-]\d{4}))" + xsd:string { pattern = + "(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), )?\d{1,2} " ~ + "((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) " ~ + "\d{4} \d{2}:\d{2}(:\d{2})? " ~ + "((UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|([\+\-]\d{4}))" } domain.name = xsd:string { pattern = "(\w\.)+\w" } path.name = xsd:string { pattern = "/?(\w/?)+" } @@ -52,19 +59,19 @@ mime.type = attribute type { xsd:string { pattern = "\w+/[\+\-\.\w]+" } } title.element = element title { text } link.element = element link { xsd:anyURI } atom.link.element = - element atom:link { - attribute href { xsd:anyURI } & - atom.link.rel? & - mime.type? & - attribute hreflang { xsd:language }? & - attribute title { text }? & - attribute length { xsd:byte }? - } + element atom:link { + attribute href { xsd:anyURI } & + atom.link.rel? & + mime.type? & + attribute hreflang { xsd:language }? & + attribute title { text }? & + attribute length { xsd:byte }? + } atom.link.rel = - attribute rel { - "alternate" | "enclosure" | "related" | "self" | "via" | - xsd:anyURI - } + attribute rel { + "alternate" | "enclosure" | "related" | "self" | "via" | + xsd:anyURI + } description.element = element description { text } language.element = element language { xsd:language } copyright.element = element copyright { text } @@ -73,75 +80,75 @@ webmaster.element = element webMaster { email.string } pubdate.element = element pubDate { rfc822.date } last-build-date.element = element lastBuildDate { rfc822.date } category.element = - element category { - attribute domain { xsd:anyURI }?, - xsd:token - } + element category { + attribute domain { xsd:anyURI }?, + xsd:token + } generator.element = element generator { text } docs.element = element docs { xsd:anyURI } cloud.element = - element cloud { - attribute domain { domain.name } & - attribute port { xsd:unsignedShort } & - attribute path { path.name } & - attribute registerProcedure { method.name } & - attribute protocol { "xml-rpc" | "soap" | "http-post" } - } + element cloud { + attribute domain { domain.name } & + attribute port { xsd:unsignedShort } & + attribute path { path.name } & + attribute registerProcedure { method.name } & + attribute protocol { "xml-rpc" | "soap" | "http-post" } + } ttl.element = element ttl { xsd:unsignedInt } image.element = - element image { - element url { xsd:anyURI } & - title.element & - link.element & - element width { xsd:unsignedInt { maxInclusive = "144" } }? & - element height { xsd:unsignedInt { maxInclusive = "400" } }? - } + element image { + element url { xsd:anyURI } & + title.element & + link.element & + element width { xsd:unsignedInt { maxInclusive = "144" } }? & + element height { xsd:unsignedInt { maxInclusive = "400" } }? + } rating.element = element rating { text } text-input.element = - element textInput { - title.element & - description.element & - element name { text } & - link.element - } + element textInput { + title.element & + description.element & + element name { text } & + link.element + } skipHours.element = - element skipHours { - xsd:integer { maxInclusive = "24" minInclusive = "0" } - } + element skipHours { + xsd:integer { maxInclusive = "24" minInclusive = "0" } + } skipDays.element = - element skipDays { - "Monday" | "Tuesday" | "Wednesday" | - "Thursday" | "Friday" | "Saturday" | "Sunday" - } + element skipDays { + "Monday" | "Tuesday" | "Wednesday" | + "Thursday" | "Friday" | "Saturday" | "Sunday" + } item.element = - element item { - (title.element | description.element)+ & - link.element? & - author.element? & - category.element* & - comments.element? & - enclosure.element? & - guid.element? & - pubdate.element? & - source.element? - } + element item { + (title.element | description.element)+ & + link.element? & + author.element? & + category.element* & + comments.element? & + enclosure.element? & + guid.element? & + pubdate.element? & + source.element? + } author.element = element author { email.string } comments.element = element comments { xsd:anyURI } enclosure.element = - element enclosure { - attribute url { xsd:anyURI } & - attribute length { xsd:unsignedInt } & - mime.type - } + element enclosure { + attribute url { xsd:anyURI } & + attribute length { xsd:unsignedInt } & + mime.type + } guid.element = - element guid { - attribute isPermaLink { "true" | "false" }?, - text - } + element guid { + attribute isPermaLink { "true" | "false" }?, + text + } source.element = - element source { - attribute url { xsd:anyURI }, - text - } + element source { + attribute url { xsd:anyURI }, + text + } diff --git a/schema/symbulatordoc.rnc b/schema/symbulatordoc.rnc index 7418f73..828bde0 120000 --- a/schema/symbulatordoc.rnc +++ b/schema/symbulatordoc.rnc @@ -1 +1 @@ -/Users/ldbeth/Public/Projects/symbdoc/symbulatordoc.rnc \ No newline at end of file +/Users/ldbeth/Public/Projects/symbdoc/symbulatordocsource.rnc \ No newline at end of file diff --git a/schema/texml.rnc b/schema/texml.rnc index 5b35de7..cd20655 100644 --- a/schema/texml.rnc +++ b/schema/texml.rnc @@ -5,61 +5,68 @@ start = tex.ml tex.pcdata = text tex.content = - (tex.pcdata | - tex.cmd | - tex.env | - tex.ctrl | - tex.spec | - tex.math ) + tex.pcdata + | tex.cmd + | tex.env + | tex.ctrl + | tex.spec + | tex.math + tex.ml = - element TeXML { - tex.content* - } + element TeXML { + tex.content* + } tex.math = - element (math | dmath) { - tex.content+ - } + element math | dmath { + tex.content+ + } -tex.cmd.name = xsd:string { pattern = "[A-Za-z]+\*?|." } +tex.cmd.name = xsd:string { + pattern = "[A-Za-z]+\*?|." +} tex.cmd = - element cmd { - attribute name { tex.cmd.name }, - (tex.opt | tex.parm)* - } + element cmd { + attribute name { tex.cmd.name }, + (tex.opt | tex.parm)* + } -tex.avaliable-options = (tex.pcdata | tex.cmd | tex.ctrl | tex.spec) +tex.avaliable-options = + tex.pcdata + | tex.cmd + | tex.ctrl + | tex.spec tex.opt = - element opt { - tex.avaliable-options* - } + element opt { + tex.avaliable-options* + } tex.parm = - element parm { - tex.avaliable-options* - } + element parm { + tex.avaliable-options* + } tex.env = - element env { - tex.env.attrlist, - tex.content* - } + element env { + tex.env.attrlist, + tex.content* + } tex.env.attrlist = - attribute name { text } & - attribute begin { text }? & - attribute end { text }? + attribute name { text } & + attribute begin { text }? & + attribute end { text }? tex.ctrl = element ctrl { attribute ch { text } } tex.group = element group { tex.content* } tex.spec = - element spec { - attribute cat { - "esc" | "bg" | "eg" | "mshift" | "align" | "parm" | - "sup" | "sub" | "comment" | "tilde " } - } + element spec { + attribute cat { + "esc" | "bg" | "eg" | "mshift" | "align" | "parm" | + "sup" | "sub" | "comment" | "tilde " } + }