xquery.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. define("dojox/highlight/languages/xquery", ["dojox/main", "../_base"], function(dojox){
  2. // Very simple XQuery language file. Would be nice
  3. // to eventually handle more of the enclosed expressions
  4. // and direct XML element construction
  5. var XQUERY_COMMENT = {
  6. className: 'comment',
  7. begin: '\\(\\:', end: '\\:\\)'
  8. };
  9. var XQUERY_KEYWORDS = {
  10. // From section A2.2 of the XQuery 1.0 specification
  11. 'ancestor': 1, 'ancestor-or-self': 1, 'and' : 1,
  12. 'as': 1, 'ascending': 1, 'at': 1, 'attribute': 1,
  13. 'base-uri': 1, 'boundary-space': 1, 'by': 1, 'case': 1,
  14. 'cast': 1, 'castable': 1, 'child': 1, 'collation': 1,
  15. 'comment': 1, 'construction': 1, 'copy-namespaces': 1,
  16. 'declare': 1, 'default': 1, 'descendant': 1, 'descendant-or-self': 1,
  17. 'descending': 1, 'div': 1, 'document': 1, 'document-node': 1,
  18. 'element': 1, 'else': 1, 'empty': 1, 'empty-sequence': 1,
  19. 'encoding': 1, 'eq': 1, 'every': 1, 'except': 1, 'external': 1,
  20. 'following': 1, 'following-sibling': 1, 'for': 1, 'function': 1,
  21. 'ge': 1, 'greatest': 1, 'gt': 1, 'idiv': 1, 'if': 1, 'import': 1,
  22. 'in': 1, 'inherit': 1, 'instance': 1, 'intersect': 1, 'is': 1,
  23. 'item': 1, 'lax': 1, 'le': 1, 'least': 1, 'let': 1, 'lt': 1,
  24. 'mod': 1, 'module': 1, 'namespace': 1, 'ne': 1, 'node': 1,
  25. 'no-inherit': 1, 'no-preserve': 1, 'of': 1, 'option': 1, 'or': 1,
  26. 'order': 1, 'ordered': 1, 'ordering': 1, 'parent': 1,
  27. 'preceding': 1, 'preceding-sibling': 1, 'preserve': 1,
  28. 'processing-instruction': 1, 'return': 1, 'satisfies': 1,
  29. 'schema': 1, 'schema-attribute': 1, 'schema-element': 1,
  30. 'self': 1, 'some': 1, 'stable': 1, 'strict': 1, 'strip': 1,
  31. 'text': 1, 'then': 1, 'to': 1, 'treat': 1, 'typeswitch': 1,
  32. 'union': 1, 'unordered': 1, 'validate': 1, 'variable': 1,
  33. 'version': 1, 'where': 1, 'xquery': 1
  34. };
  35. var dh = dojox.highlight, dhc = dh.constants;
  36. dh.languages.xquery = {
  37. case_insensitive: true,
  38. defaultMode: {
  39. lexems: [dhc.IDENT_RE],
  40. contains: ['string', 'number', 'comment'],
  41. keywords: {
  42. 'keyword': XQUERY_KEYWORDS
  43. }
  44. },
  45. modes: [
  46. XQUERY_COMMENT
  47. ],
  48. XQUERY_COMMENT: XQUERY_COMMENT
  49. };
  50. return dh.languages.xquery;
  51. });