1 |
- {"version":3,"file":"mode-latex-7d97bef9.js","sources":["../../node_modules/ace-builds/src-noconflict/mode-latex.js"],"sourcesContent":["ace.define(\"ace/mode/latex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"], function(require, exports, module){\"use strict\";\nvar oop = require(\"../lib/oop\");\nvar TextHighlightRules = require(\"./text_highlight_rules\").TextHighlightRules;\nvar LatexHighlightRules = function () {\n this.$rules = {\n \"start\": [{\n token: \"comment\",\n regex: \"%.*$\"\n }, {\n token: [\"keyword\", \"lparen\", \"variable.parameter\", \"rparen\", \"lparen\", \"storage.type\", \"rparen\"],\n regex: \"(\\\\\\\\(?:documentclass|usepackage|input))(?:(\\\\[)([^\\\\]]*)(\\\\]))?({)([^}]*)(})\"\n }, {\n token: [\"keyword\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?\"\n }, {\n token: [\"storage.type\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\begin)({)(verbatim)(})\",\n next: \"verbatim\"\n }, {\n token: [\"storage.type\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\begin)({)(lstlisting)(})\",\n next: \"lstlisting\"\n }, {\n token: [\"storage.type\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\(?:begin|end))({)([\\\\w*]*)(})\"\n }, {\n token: \"storage.type\",\n regex: /\\\\verb\\b\\*?/,\n next: [{\n token: [\"keyword.operator\", \"string\", \"keyword.operator\"],\n regex: \"(.)(.*?)(\\\\1|$)|\",\n next: \"start\"\n }]\n }, {\n token: \"storage.type\",\n regex: \"\\\\\\\\[a-zA-Z]+\"\n }, {\n token: \"lparen\",\n regex: \"[[({]\"\n }, {\n token: \"rparen\",\n regex: \"[\\\\])}]\"\n }, {\n token: \"constant.character.escape\",\n regex: \"\\\\\\\\[^a-zA-Z]?\"\n }, {\n token: \"string\",\n regex: \"\\\\${1,2}\",\n next: \"equation\"\n }],\n \"equation\": [{\n token: \"comment\",\n regex: \"%.*$\"\n }, {\n token: \"string\",\n regex: \"\\\\${1,2}\",\n next: \"start\"\n }, {\n token: \"constant.character.escape\",\n regex: \"\\\\\\\\(?:[^a-zA-Z]|[a-zA-Z]+)\"\n }, {\n token: \"error\",\n regex: \"^\\\\s*$\",\n next: \"start\"\n }, {\n defaultToken: \"string\"\n }],\n \"verbatim\": [{\n token: [\"storage.type\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\end)({)(verbatim)(})\",\n next: \"start\"\n }, {\n defaultToken: \"text\"\n }],\n \"lstlisting\": [{\n token: [\"storage.type\", \"lparen\", \"variable.parameter\", \"rparen\"],\n regex: \"(\\\\\\\\end)({)(lstlisting)(})\",\n next: \"start\"\n }, {\n defaultToken: \"text\"\n }]\n };\n this.normalizeRules();\n};\noop.inherits(LatexHighlightRules, TextHighlightRules);\nexports.LatexHighlightRules = LatexHighlightRules;\n\n});\n\nace.define(\"ace/mode/folding/latex\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\",\"ace/token_iterator\"], function(require, exports, module){\"use strict\";\nvar oop = require(\"../../lib/oop\");\nvar BaseFoldMode = require(\"./fold_mode\").FoldMode;\nvar Range = require(\"../../range\").Range;\nvar TokenIterator = require(\"../../token_iterator\").TokenIterator;\nvar keywordLevels = {\n \"\\\\subparagraph\": 1,\n \"\\\\paragraph\": 2,\n \"\\\\subsubsubsection\": 3,\n \"\\\\subsubsection\": 4,\n \"\\\\subsection\": 5,\n \"\\\\section\": 6,\n \"\\\\chapter\": 7,\n \"\\\\part\": 8,\n \"\\\\begin\": 9,\n \"\\\\end\": 10\n};\nvar FoldMode = exports.FoldMode = function () { };\noop.inherits(FoldMode, BaseFoldMode);\n(function () {\n this.foldingStartMarker = /^\\s*\\\\(begin)|\\s*\\\\(part|chapter|(?:sub)*(?:section|paragraph))\\b|{\\s*$/;\n this.foldingStopMarker = /^\\s*\\\\(end)\\b|^\\s*}/;\n this.getFoldWidgetRange = function (session, foldStyle, row) {\n var line = session.doc.getLine(row);\n var match = this.foldingStartMarker.exec(line);\n if (match) {\n if (match[1])\n return this.latexBlock(session, row, match[0].length - 1);\n if (match[2])\n return this.latexSection(session, row, match[0].length - 1);\n return this.openingBracketBlock(session, \"{\", row, match.index);\n }\n var match = this.foldingStopMarker.exec(line);\n if (match) {\n if (match[1])\n return this.latexBlock(session, row, match[0].length - 1);\n return this.closingBracketBlock(session, \"}\", row, match.index + match[0].length);\n }\n };\n this.latexBlock = function (session, row, column, returnRange) {\n var keywords = {\n \"\\\\begin\": 1,\n \"\\\\end\": -1\n };\n var stream = new TokenIterator(session, row, column);\n var token = stream.getCurrentToken();\n if (!token || !(token.type == \"storage.type\" || token.type == \"constant.character.escape\"))\n return;\n var val = token.value;\n var dir = keywords[val];\n var getType = function () {\n var token = stream.stepForward();\n var type = token && token.type == \"lparen\" ? stream.stepForward().value : \"\";\n if (dir === -1) {\n stream.stepBackward();\n if (type)\n stream.stepBackward();\n }\n return type;\n };\n var stack = [getType()];\n var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;\n var startRow = row;\n stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;\n while (token = stream.step()) {\n if (!token || !(token.type == \"storage.type\" || token.type == \"constant.character.escape\"))\n continue;\n var level = keywords[token.value];\n if (!level)\n continue;\n var type = getType();\n if (level === dir)\n stack.unshift(type);\n else if (stack.shift() !== type || !stack.length)\n break;\n }\n if (stack.length)\n return;\n if (dir == 1) {\n stream.stepBackward();\n stream.stepBackward();\n }\n if (returnRange)\n return stream.getCurrentTokenRange();\n var row = stream.getCurrentTokenRow();\n if (dir === -1)\n return new Range(row, session.getLine(row).length, startRow, startColumn);\n else\n return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());\n };\n this.latexSection = function (session, row, column) {\n var stream = new TokenIterator(session, row, column);\n var token = stream.getCurrentToken();\n if (!token || token.type != \"storage.type\")\n return;\n var startLevel = keywordLevels[token.value] || 0;\n var stackDepth = 0;\n var endRow = row;\n while (token = stream.stepForward()) {\n if (token.type !== \"storage.type\")\n continue;\n var level = keywordLevels[token.value] || 0;\n if (level >= 9) {\n if (!stackDepth)\n endRow = stream.getCurrentTokenRow() - 1;\n stackDepth += level == 9 ? 1 : -1;\n if (stackDepth < 0)\n break;\n }\n else if (level >= startLevel)\n break;\n }\n if (!stackDepth)\n endRow = stream.getCurrentTokenRow() - 1;\n while (endRow > row && !/\\S/.test(session.getLine(endRow)))\n endRow--;\n return new Range(row, session.getLine(row).length, endRow, session.getLine(endRow).length);\n };\n}).call(FoldMode.prototype);\n\n});\n\nace.define(\"ace/mode/latex\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/latex_highlight_rules\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/latex\"], function(require, exports, module){\"use strict\";\nvar oop = require(\"../lib/oop\");\nvar TextMode = require(\"./text\").Mode;\nvar LatexHighlightRules = require(\"./latex_highlight_rules\").LatexHighlightRules;\nvar CstyleBehaviour = require(\"./behaviour/cstyle\").CstyleBehaviour;\nvar LatexFoldMode = require(\"./folding/latex\").FoldMode;\nvar Mode = function () {\n this.HighlightRules = LatexHighlightRules;\n this.foldingRules = new LatexFoldMode();\n this.$behaviour = new CstyleBehaviour({ braces: true });\n};\noop.inherits(Mode, TextMode);\n(function () {\n this.type = \"text\";\n this.lineCommentStart = \"%\";\n this.$id = \"ace/mode/latex\";\n this.getMatching = function (session, row, column) {\n if (row == undefined)\n row = session.selection.lead;\n if (typeof row == \"object\") {\n column = row.column;\n row = row.row;\n }\n var startToken = session.getTokenAt(row, column);\n if (!startToken)\n return;\n if (startToken.value == \"\\\\begin\" || startToken.value == \"\\\\end\") {\n return this.foldingRules.latexBlock(session, row, column, true);\n }\n };\n}).call(Mode.prototype);\nexports.Mode = Mode;\n\n}); (function() {\n ace.require([\"ace/mode/latex\"], function(m) {\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = m;\n }\n });\n })();\n "],"names":["require","exports","module","oop","TextHighlightRules","LatexHighlightRules","BaseFoldMode","Range","TokenIterator","keywordLevels","FoldMode","session","foldStyle","row","line","match","column","returnRange","keywords","stream","token","val","dir","getType","type","stack","startColumn","startRow","level","startLevel","stackDepth","endRow","TextMode","CstyleBehaviour","LatexFoldMode","Mode","startToken","m"],"mappings":"gaAAA,IAAI,OAAO,iCAAiC,CAAC,UAAU,UAAU,SAAS,cAAc,+BAA+B,EAAG,SAASA,EAASC,EAASC,EAAO,CAC5J,IAAIC,EAAMH,EAAQ,YAAY,EAC1BI,EAAqBJ,EAAQ,wBAAwB,EAAE,mBACvDK,EAAsB,UAAY,CAClC,KAAK,OAAS,CACV,MAAS,CAAC,CACF,MAAO,UACP,MAAO,MACvB,EAAe,CACC,MAAO,CAAC,UAAW,SAAU,qBAAsB,SAAU,SAAU,eAAgB,QAAQ,EAC/F,MAAO,+EACvB,EAAe,CACC,MAAO,CAAC,UAAW,SAAU,qBAAsB,QAAQ,EAC3D,MAAO,uDACvB,EAAe,CACC,MAAO,CAAC,eAAgB,SAAU,qBAAsB,QAAQ,EAChE,MAAO,8BACP,KAAM,UACtB,EAAe,CACC,MAAO,CAAC,eAAgB,SAAU,qBAAsB,QAAQ,EAChE,MAAO,gCACP,KAAM,YACtB,EAAe,CACC,MAAO,CAAC,eAAgB,SAAU,qBAAsB,QAAQ,EAChE,MAAO,oCACvB,EAAe,CACC,MAAO,eACP,MAAO,cACP,KAAM,CAAC,CACC,MAAO,CAAC,mBAAoB,SAAU,kBAAkB,EACxD,MAAO,mBACP,KAAM,OAC9B,CAAqB,CACrB,EAAe,CACC,MAAO,eACP,MAAO,eACvB,EAAe,CACC,MAAO,SACP,MAAO,OACvB,EAAe,CACC,MAAO,SACP,MAAO,SACvB,EAAe,CACC,MAAO,4BACP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