grammar.pegjs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // http://www.w3.org/TR/xml/#NT-Name
  2. NameStartChar = ":" / [A-Z] / "_" / [a-z] / [\u00C0-\u00D6] / [\u00D8-\u00F6] / [\u00F8-\u02FF] / [\u0370-\u037D] /
  3. [\u037F-\u1FFF] / [\u200C-\u200D] / [\u2070-\u218F] / [\u2C00-\u2FEF] / [\u3001-\uD7FF] /
  4. [\uF900-\uFDCF] / [\uFDF0-\uFFFD] / [\uD800-\uDB7F][\uDC00-\uDFFF] ;
  5. // last clause above produced by https://mothereff.in/regexpu#%2F%5B%5Cu%7B10000%7D-%5Cu%7BEFFFF%7D%5D%2Fu
  6. NameChar = NameStartChar / "-" / "." / [0-9] / "\u00B7" / [\u0300-\u036F] / [\u203F-\u2040] ;
  7. Name = NameStartChar NameChar* ;
  8. // http://www.w3.org/TR/xml-names/#NT-QName
  9. QName = PrefixedName
  10. / UnprefixedName ;
  11. PrefixedName = Prefix ":" LocalPart ;
  12. UnprefixedName = LocalPart ;
  13. Prefix = NCName ;
  14. LocalPart = NCName ;
  15. // http://www.w3.org/TR/xml-names/#NT-NCName
  16. // Same as Name productions but removing the ":" from NCNameStartChar
  17. NCNameStartChar = [A-Z] / "_" / [a-z] / [\u00C0-\u00D6] / [\u00D8-\u00F6] / [\u00F8-\u02FF] / [\u0370-\u037D] /
  18. [\u037F-\u1FFF] / [\u200C-\u200D] / [\u2070-\u218F] / [\u2C00-\u2FEF] / [\u3001-\uD7FF] /
  19. [\uF900-\uFDCF] / [\uFDF0-\uFFFD] / [\uD800-\uDB7F][\uDC00-\uDFFF] ;
  20. NCNameChar = NCNameStartChar / "-" / "." / [0-9] / "\u00B7" / [\u0300-\u036F] / [\u203F-\u2040] ;
  21. NCName = NCNameStartChar NCNameChar* ;