tex.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * tex.js
  3. *
  4. * Copyright (C) 2009-11 by RStudio, Inc.
  5. *
  6. * The Initial Developer of the Original Code is
  7. * Ajax.org B.V.
  8. * Portions created by the Initial Developer are Copyright (C) 2010
  9. * the Initial Developer. All Rights Reserved.
  10. *
  11. * Distributed under the BSD license:
  12. *
  13. * Copyright (c) 2010, Ajax.org B.V.
  14. * All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions are met:
  18. * * Redistributions of source code must retain the above copyright
  19. * notice, this list of conditions and the following disclaimer.
  20. * * Redistributions in binary form must reproduce the above copyright
  21. * notice, this list of conditions and the following disclaimer in the
  22. * documentation and/or other materials provided with the distribution.
  23. * * Neither the name of Ajax.org B.V. nor the
  24. * names of its contributors may be used to endorse or promote products
  25. * derived from this software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  28. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  29. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  30. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
  31. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  32. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  33. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  34. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  35. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  36. *
  37. */
  38. define(function(require, exports, module) {
  39. "use strict";
  40. var oop = require("../lib/oop");
  41. var TextMode = require("./text").Mode;
  42. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  43. var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
  44. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  45. var Mode = function(suppressHighlighting) {
  46. if (suppressHighlighting)
  47. this.HighlightRules = TextHighlightRules;
  48. else
  49. this.HighlightRules = TexHighlightRules;
  50. this.$outdent = new MatchingBraceOutdent();
  51. };
  52. oop.inherits(Mode, TextMode);
  53. (function() {
  54. this.lineCommentStart = "%";
  55. this.getNextLineIndent = function(state, line, tab) {
  56. return this.$getIndent(line);
  57. };
  58. this.allowAutoInsert = function() {
  59. return false;
  60. };
  61. this.$id = "ace/mode/tex";
  62. }).call(Mode.prototype);
  63. exports.Mode = Mode;
  64. });