xquery.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.highlight.languages.xquery"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.highlight.languages.xquery"] = true;
  8. dojo.provide("dojox.highlight.languages.xquery");
  9. dojo.require("dojox.highlight._base");
  10. // Very simple XQuery language file. Would be nice
  11. // to eventually handle more of the enclosed expressions
  12. // and direct XML element construction
  13. (function(){
  14. var XQUERY_COMMENT = {
  15. className: 'comment',
  16. begin: '\\(\\:', end: '\\:\\)'
  17. };
  18. var XQUERY_KEYWORDS = {
  19. // From section A2.2 of the XQuery 1.0 specification
  20. 'ancestor': 1, 'ancestor-or-self': 1, 'and' : 1,
  21. 'as': 1, 'ascending': 1, 'at': 1, 'attribute': 1,
  22. 'base-uri': 1, 'boundary-space': 1, 'by': 1, 'case': 1,
  23. 'cast': 1, 'castable': 1, 'child': 1, 'collation': 1,
  24. 'comment': 1, 'construction': 1, 'copy-namespaces': 1,
  25. 'declare': 1, 'default': 1, 'descendant': 1, 'descendant-or-self': 1,
  26. 'descending': 1, 'div': 1, 'document': 1, 'document-node': 1,
  27. 'element': 1, 'else': 1, 'empty': 1, 'empty-sequence': 1,
  28. 'encoding': 1, 'eq': 1, 'every': 1, 'except': 1, 'external': 1,
  29. 'following': 1, 'following-sibling': 1, 'for': 1, 'function': 1,
  30. 'ge': 1, 'greatest': 1, 'gt': 1, 'idiv': 1, 'if': 1, 'import': 1,
  31. 'in': 1, 'inherit': 1, 'instance': 1, 'intersect': 1, 'is': 1,
  32. 'item': 1, 'lax': 1, 'le': 1, 'least': 1, 'let': 1, 'lt': 1,
  33. 'mod': 1, 'module': 1, 'namespace': 1, 'ne': 1, 'node': 1,
  34. 'no-inherit': 1, 'no-preserve': 1, 'of': 1, 'option': 1, 'or': 1,
  35. 'order': 1, 'ordered': 1, 'ordering': 1, 'parent': 1,
  36. 'preceding': 1, 'preceding-sibling': 1, 'preserve': 1,
  37. 'processing-instruction': 1, 'return': 1, 'satisfies': 1,
  38. 'schema': 1, 'schema-attribute': 1, 'schema-element': 1,
  39. 'self': 1, 'some': 1, 'stable': 1, 'strict': 1, 'strip': 1,
  40. 'text': 1, 'then': 1, 'to': 1, 'treat': 1, 'typeswitch': 1,
  41. 'union': 1, 'unordered': 1, 'validate': 1, 'variable': 1,
  42. 'version': 1, 'where': 1, 'xquery': 1
  43. };
  44. var dh = dojox.highlight, dhc = dh.constants;
  45. dh.languages.xquery = {
  46. case_insensitive: true,
  47. defaultMode: {
  48. lexems: [dhc.IDENT_RE],
  49. contains: ['string', 'number', 'comment'],
  50. keywords: {
  51. 'keyword': XQUERY_KEYWORDS
  52. }
  53. },
  54. modes: [
  55. XQUERY_COMMENT
  56. ],
  57. XQUERY_COMMENT: XQUERY_COMMENT
  58. };
  59. })();
  60. }