You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
28 KiB

12 months ago
  1. ace.define("ace/mode/mel_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  2. "use strict";
  3. var oop = acequire("../lib/oop");
  4. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  5. var MELHighlightRules = function() {
  6. this.$rules = { start:
  7. [ { caseInsensitive: true,
  8. token: 'storage.type.mel',
  9. regex: '\\b(matrix|string|vector|float|int|void)\\b' },
  10. { caseInsensitive: true,
  11. token: 'support.function.mel',
  12. regex: '\\b((s(h(ow(ManipCtx|S(hadingGroupAttrEditor|electionInTitle)|H(idden|elp)|Window)|el(f(Button|TabLayout|Layout)|lField)|ading(GeometryRelCtx|Node|Connection|LightRelCtx))|y(s(tem|File)|mbol(Button|CheckBox))|nap(shot|Mode|2to2 |TogetherCtx|Key)|c(ulpt|ene(UIReplacement|Editor)|ale(BrushBrightness |Constraint|Key(Ctx)?)?|r(ipt(Node|Ctx|Table|edPanel(Type)?|Job|EditorInfo)|oll(Field|Layout))|mh)|t(itch(Surface(Points)?|AndExplodeShell )|a(ckTrace|rt(sWith |String ))|r(cmp|i(ng(ToStringArray |Array(Remove(Duplicates | )|C(ount |atenate )|ToString |Intersector))|p )|oke))|i(n(gleProfileBirailSurface)?|ze|gn|mplify)|o(u(nd(Control)?|rce)|ft(Mod(Ctx)?)?|rt)|u(perCtx|rface(S(haderList|ampler))?|b(st(itute(Geometry|AllString )?|ring)|d(M(irror|a(tchTopology|p(SewMove|Cut)))|iv(Crease|DisplaySmoothness)?|C(ollapse|leanTopology)|T(o(Blind|Poly)|ransferUVsToCache)|DuplicateAndConnect|EditUV|ListComponentConversion|AutoProjection)))|p(h(ere|rand)|otLight(PreviewPort)?|aceLocator|r(ing|eadSheetEditor))|e(t(s|MenuMode|Sta(te |rtupMessage|mpDensity )|NodeTypeFlag|ConstraintRestPosition |ToolTo|In(putDeviceMapping|finity)|D(ynamic|efaultShadingGroup|rivenKeyframe)|UITemplate|P(ar(ticleAttr|ent)|roject )|E(scapeCtx|dit(or|Ctx))|Key(Ctx|frame|Path)|F(ocus|luidAttr)|Attr(Mapping)?)|parator|ed|l(ect(Mode|ionConnection|Context|Type|edNodes|Pr(iority|ef)|Key(Ctx)?)?|LoadSettings)|archPathArray )|kin(Cluster|Percent)|q(uareSurface|rt)|w(itchTable|atchDisplayPort)|a(ve(Menu|Shelf|ToolSettings|I(nitialState|mage)|Pref(s|Objects)|Fluid|A(ttrPreset |llShelves))|mpleImage)|rtContext|mooth(step|Curve|TangentSurface))|h(sv_to_rgb|yp(ot|er(Graph|Shade|Panel))|i(tTest|de|lite)|ot(Box|key(Check)?)|ud(Button|Slider(Button)?)|e(lp(Line)?|adsUpDisplay|rmite)|wRe(nder(Load)?|flectionMap)|ard(enPointCurve|ware(RenderPanel)?))|n(o(nLinear|ise|de(Type|IconButton|Outliner|Preset)|rmal(ize |Constraint))|urbs(Boolean|S(elect|quare)|C(opyUVSet|ube)|To(Subdiv|Poly(gonsPref)?)|Plane|ViewDirectionVector )|ew(ton|PanelItems)|ame(space(Info)?|Command|Field))|c(h(oice|dir|eck(Box(Grp)?|DefaultRenderGlobals)|a(n(nelBox|geSubdiv(Region|ComponentDisplayLevel))|racter(Map|OutlineEditor)?))|y(cleCheck|linder)|tx(Completion|Traverse|EditMode|Abort)|irc(ularFillet|le)|o(s|n(str(uctionHistory|ain(Value)?)|nect(ionInfo|Control|Dynamic|Joint|Attr)|t(extInfo|rol)|dition|e|vert(SolidTx|Tessellation|Unit|FromOldLayers |Lightmap)|firmDialog)|py(SkinWeights|Key|Flexor|Array )|l(or(Slider(Grp|ButtonGrp)|Index(SliderGrp)?|Editor|AtPoint)?|umnLayout|lision)|arsenSubdivSelectionList|m(p(onentEditor|utePolysetVolume |actHairSystem )|mand(Port|Echo|Line)))|u(tKey|r(ve(MoveEPCtx|SketchCtx|CVCtx|Intersect|OnSurface|E(ditorCtx|PCtx)|AddPtCtx)?|rent(Ctx|Time(Ctx)?|Unit)))|p(GetSolverAttr|Button|S(olver(Types)?|e(t(SolverAttr|Edit)|am))|C(o(nstraint|llision)|ache)|Tool|P(anel|roperty))|eil|l(ip(Schedule(rOutliner)?|TrimBefore |Editor(CurrentTimeCtx)?)?|ose(Surface|Curve)|uster|ear(Cache)?|amp)|a(n(CreateManip|vas)|tch(Quiet)?|pitalizeString |mera(View)?)|r(oss(Product )?|eate(RenderLayer|MotionField |SubdivRegion|N(ode|ewShelf )|D(isplayLayer|rawCtx)|Editor))|md(Shell|FileOutput))|M(R(ender(ShadowData|Callback|Data|Util|View|Line(Array)?)|ampAttribute)|G(eometryData|lobal)|M(odelMessage|essage|a(nipData|t(erial|rix)))|BoundingBox|S(yntax|ceneMessage|t(atus|ring(Array)?)|imple|pace|elect(ion(Mask|List)|Info)|watchRender(Register|Base))|H(ardwareRenderer|WShaderSwatchGenerator)|NodeMessage|C(o(nditionMessage|lor(Array)?|m(putation|mand(Result|Message)))|ursor|loth(Material|S(ystem|olverRegister)|Con(straint|trol)|Triangle|Particle|Edge|Force)|allbackIdArray)|T(ypeId|ime(r(Message)?|Array)?|oolsInfo|esselationParams|r(imBoundaryArray|ansformationMatrix))|I(ntArray|t(Geometry|Mesh(Polygon|Edge|Vertex|FaceVertex)|S(urfaceCV|electionList)|CurveCV|Instancer|eratorType|D(ependency(Graph|Nodes)|ag)|Keyframe)|k(System|HandleGroup)|mage)|3dView|Object(SetMessage|Handle|Array)?|D(G(M(odifier|essage)|Context)|ynSwept(Triangle|Line)|istance|oubleArray|evice(State|Channel)|a(ta(Block|Handl
  13. { caseInsensitive: true,
  14. token: 'support.constant.mel',
  15. regex: '\\b(s(h(ellTessellate|a(d(ing(Map|Engine)|erGlow)|pe))|n(ow|apshot(Shape)?)|c(ulpt|aleConstraint|ript)|t(yleCurve|itch(Srf|AsNurbsShell)|u(cco|dioClearCoat)|encil|roke(Globals)?)|i(ngleShadingSwitch|mpleVolumeShader)|o(ftMod(Manip|Handle)?|lidFractal)|u(rface(Sha(der|pe)|Info|EdManip|VarGroup|Luminance)|b(Surface|d(M(odifier(UV|World)?|ap(SewMove|Cut|pingManip))|B(lindData|ase)|iv(ReverseFaces|SurfaceVarGroup|Co(llapse|mponentId)|To(Nurbs|Poly))?|HierBlind|CleanTopology|Tweak(UV)?|P(lanarProj|rojManip)|LayoutUV|A(ddTopology|utoProj))|Curve))|p(BirailSrf|otLight|ring)|e(tRange|lectionListOperator)|k(inCluster|etchPlane)|quareSrf|ampler(Info)?|m(ooth(Curve|TangentSrf)|ear))|h(svToRgb|yper(GraphInfo|View|Layout)|ik(Solver|Handle|Effector)|oldMatrix|eightField|w(Re(nderGlobals|flectionMap)|Shader)|a(ir(System|Constraint|TubeShader)|rd(enPoint|wareRenderGlobals)))|n(o(n(ExtendedLightShapeNode|Linear|AmbientLightShapeNode)|ise|rmalConstraint)|urbs(Surface|Curve|T(oSubdiv(Proc)?|essellate)|DimShape)|e(twork|wtonField))|c(h(o(ice|oser)|ecker|aracter(Map|Offset)?)|o(n(straint|tr(olPoint|ast)|dition)|py(ColorSet|UVSet))|urve(Range|Shape|Normalizer(Linear|Angle)?|In(tersect|fo)|VarGroup|From(Mesh(CoM|Edge)?|Su(rface(Bnd|CoS|Iso)?|bdiv(Edge|Face)?)))|l(ip(Scheduler|Library)|o(se(stPointOnSurface|Surface|Curve)|th|ud)|uster(Handle)?|amp)|amera(View)?|r(eate(BPManip|ColorSet|UVSet)|ater))|t(ime(ToUnitConversion|Function)?|oo(nLineAttributes|lDrawManip)|urbulenceField|ex(BaseDeformManip|ture(BakeSet|2d|ToGeom|3d|Env)|SmudgeUVManip|LatticeDeformManip)|weak|angentConstraint|r(i(pleShadingSwitch|m(WithBoundaries)?)|ansform(Geometry)?))|i(n(s(tancer|ertKnot(Surface|Curve))|tersectSurface)|k(RPsolver|MCsolver|S(ystem|olver|Csolver|plineSolver)|Handle|PASolver|Effector)|m(plicit(Box|Sphere|Cone)|agePlane))|o(cean(Shader)?|pticalFX|ffset(Surface|C(os|urve))|ldBlindDataBase|rient(Constraint|ationMarker)|bject(RenderFilter|MultiFilter|BinFilter|S(criptFilter|et)|NameFilter|TypeFilter|Filter|AttrFilter))|d(yn(Globals|Base)|i(s(tance(Between|DimShape)|pla(yLayer(Manager)?|cementShader)|kCache)|rect(ionalLight|edDisc)|mensionShape)|o(ubleShadingSwitch|f)|pBirailSrf|e(tach(Surface|Curve)|pendNode|f(orm(Bend|S(ine|quash)|Twist|ableShape|F(unc|lare)|Wave)|ault(RenderUtilityList|ShaderList|TextureList|LightList))|lete(Co(lorSet|mponent)|UVSet))|ag(Node|Pose)|r(opoffLocator|agField))|u(seBackground|n(trim|i(t(Conversion|ToTimeConversion)|formField)|known(Transform|Dag)?)|vChooser)|j(iggle|oint(Cluster|Ffd|Lattice)?)|p(sdFileTex|hong(E)?|o(s(tProcessList|itionMarker)|int(MatrixMult|Constraint|On(SurfaceInfo|CurveInfo)|Emitter|Light)|l(y(Reduce|M(irror|o(difier(UV|World)?|ve(UV|Edge|Vertex|Face(tUV)?))|erge(UV|Edge|Vert|Face)|ap(Sew(Move)?|Cut|Del))|B(oolOp|evel|lindData|ase)|S(traightenUVBorder|oftEdge|ubd(Edge|Face)|p(h(ere|Proj)|lit(Ring|Edge|Vert)?)|e(parate|wEdge)|mooth(Proxy|Face)?)|Normal(izeUV|PerVertex)?|C(hipOff|yl(inder|Proj)|o(ne|pyUV|l(orPerVertex|lapse(Edge|F)))|u(t(Manip(Container)?)?|be)|loseBorder|rea(seEdge|t(or|eFace)))|T(o(Subdiv|rus)|weak(UV)?|r(iangulate|ansfer))|OptUvs|D(uplicateEdge|el(Edge|Vertex|Facet))|Unite|P(yramid|oke(Manip)?|lan(e|arProj)|r(i(sm|mitive)|oj))|Extrude(Edge|Vertex|Face)|VertexNormalManip|Quad|Flip(UV|Edge)|WedgeFace|LayoutUV|A(utoProj|ppend(Vertex)?|verageVertex))|eVectorConstraint))|fx(Geometry|Hair|Toon)|l(usMinusAverage|a(n(e|arTrimSurface)|ce(2dTexture|3dTexture)))|a(ssMatrix|irBlend|r(ti(cle(SamplerInfo|C(olorMapper|loud)|TranspMapper|IncandMapper|AgeMapper)?|tion)|ent(Constraint|Tessellate)|amDimension))|r(imitive|o(ject(ion|Curve|Tangent)|xyManager)))|e(n(tity|v(Ball|ironmentFog|S(phere|ky)|C(hrome|ube)|Fog))|x(t(end(Surface|Curve)|rude)|p(lodeNurbsShell|ression)))|v(iewManip|o(lume(Shader|Noise|Fog|Light|AxisField)|rtexField)|e(ctor(RenderGlobals|Product)|rtexBakeSet))|quadShadingSwitch|f(i(tBspline|eld|l(ter(Resample|Simplify|ClosestSample|Euler)?|e|letCurve))|o(urByFourMatrix|llicle)|urPointOn(MeshInfo|Subd)|f(BlendSrf(Obsolete)?|d|FilletSrf)|l(ow|uid(S(hape|liceManip)|Texture(2D|
  16. { caseInsensitive: true,
  17. token: 'keyword.control.mel',
  18. regex: '\\b(if|in|else|for|while|break|continue|case|default|do|switch|return|switch|case|source|catch|alias)\\b' },
  19. { token: 'keyword.other.mel', regex: '\\b(global)\\b' },
  20. { caseInsensitive: true,
  21. token: 'constant.language.mel',
  22. regex: '\\b(null|undefined)\\b' },
  23. { token: 'constant.numeric.mel',
  24. regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b' },
  25. { token: 'punctuation.definition.string.begin.mel',
  26. regex: '"',
  27. push:
  28. [ { token: 'constant.character.escape.mel', regex: '\\\\.' },
  29. { token: 'punctuation.definition.string.end.mel',
  30. regex: '"',
  31. next: 'pop' },
  32. { defaultToken: 'string.quoted.double.mel' } ] },
  33. { token: [ 'variable.other.mel', 'punctuation.definition.variable.mel' ],
  34. regex: '(\\$)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*?\\b)' },
  35. { token: 'punctuation.definition.string.begin.mel',
  36. regex: '\'',
  37. push:
  38. [ { token: 'constant.character.escape.mel', regex: '\\\\.' },
  39. { token: 'punctuation.definition.string.end.mel',
  40. regex: '\'',
  41. next: 'pop' },
  42. { defaultToken: 'string.quoted.single.mel' } ] },
  43. { token: 'constant.language.mel',
  44. regex: '\\b(false|true|yes|no|on|off)\\b' },
  45. { token: 'punctuation.definition.comment.mel',
  46. regex: '/\\*',
  47. push:
  48. [ { token: 'punctuation.definition.comment.mel',
  49. regex: '\\*/',
  50. next: 'pop' },
  51. { defaultToken: 'comment.block.mel' } ] },
  52. { token: [ 'comment.line.double-slash.mel', 'punctuation.definition.comment.mel' ],
  53. regex: '(//)(.*$\\n?)' },
  54. { caseInsensitive: true,
  55. token: 'keyword.operator.mel',
  56. regex: '\\b(instanceof)\\b' },
  57. { token: 'keyword.operator.symbolic.mel',
  58. regex: '[-\\!\\%\\&\\*\\+\\=\\/\\?\\:]' },
  59. { token: [ 'meta.preprocessor.mel', 'punctuation.definition.preprocessor.mel' ],
  60. regex: '(^[ \\t]*)((?:#)[a-zA-Z]+)' },
  61. { token: [ 'meta.function.mel', 'keyword.other.mel', 'storage.type.mel', 'entity.name.function.mel', 'punctuation.section.function.mel' ],
  62. regex: '(global\\s*)?(proc\\s*)(\\w+\\s*\\[?\\]?\\s+|\\s+)([A-Za-z_][A-Za-z0-9_\\.]*)(\\s*\\()',
  63. push:
  64. [ { include: '$self' },
  65. { token: 'punctuation.section.function.mel',
  66. regex: '\\)',
  67. next: 'pop' },
  68. { defaultToken: 'meta.function.mel' } ] }
  69. ] };
  70. this.normalizeRules();
  71. };
  72. oop.inherits(MELHighlightRules, TextHighlightRules);
  73. exports.MELHighlightRules = MELHighlightRules;
  74. });
  75. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  76. "use strict";
  77. var oop = acequire("../../lib/oop");
  78. var Range = acequire("../../range").Range;
  79. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  80. var FoldMode = exports.FoldMode = function(commentRegex) {
  81. if (commentRegex) {
  82. this.foldingStartMarker = new RegExp(
  83. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  84. );
  85. this.foldingStopMarker = new RegExp(
  86. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  87. );
  88. }
  89. };
  90. oop.inherits(FoldMode, BaseFoldMode);
  91. (function() {
  92. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  93. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  94. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  95. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  96. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  97. this._getFoldWidgetBase = this.getFoldWidget;
  98. this.getFoldWidget = function(session, foldStyle, row) {
  99. var line = session.getLine(row);
  100. if (this.singleLineBlockCommentRe.test(line)) {
  101. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  102. return "";
  103. }
  104. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  105. if (!fw && this.startRegionRe.test(line))
  106. return "start"; // lineCommentRegionStart
  107. return fw;
  108. };
  109. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  110. var line = session.getLine(row);
  111. if (this.startRegionRe.test(line))
  112. return this.getCommentRegionBlock(session, line, row);
  113. var match = line.match(this.foldingStartMarker);
  114. if (match) {
  115. var i = match.index;
  116. if (match[1])
  117. return this.openingBracketBlock(session, match[1], row, i);
  118. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  119. if (range && !range.isMultiLine()) {
  120. if (forceMultiline) {
  121. range = this.getSectionRange(session, row);
  122. } else if (foldStyle != "all")
  123. range = null;
  124. }
  125. return range;
  126. }
  127. if (foldStyle === "markbegin")
  128. return;
  129. var match = line.match(this.foldingStopMarker);
  130. if (match) {
  131. var i = match.index + match[0].length;
  132. if (match[1])
  133. return this.closingBracketBlock(session, match[1], row, i);
  134. return session.getCommentFoldRange(row, i, -1);
  135. }
  136. };
  137. this.getSectionRange = function(session, row) {
  138. var line = session.getLine(row);
  139. var startIndent = line.search(/\S/);
  140. var startRow = row;
  141. var startColumn = line.length;
  142. row = row + 1;
  143. var endRow = row;
  144. var maxRow = session.getLength();
  145. while (++row < maxRow) {
  146. line = session.getLine(row);
  147. var indent = line.search(/\S/);
  148. if (indent === -1)
  149. continue;
  150. if (startIndent > indent)
  151. break;
  152. var subRange = this.getFoldWidgetRange(session, "all", row);
  153. if (subRange) {
  154. if (subRange.start.row <= startRow) {
  155. break;
  156. } else if (subRange.isMultiLine()) {
  157. row = subRange.end.row;
  158. } else if (startIndent == indent) {
  159. break;
  160. }
  161. }
  162. endRow = row;
  163. }
  164. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  165. };
  166. this.getCommentRegionBlock = function(session, line, row) {
  167. var startColumn = line.search(/\s*$/);
  168. var maxRow = session.getLength();
  169. var startRow = row;
  170. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  171. var depth = 1;
  172. while (++row < maxRow) {
  173. line = session.getLine(row);
  174. var m = re.exec(line);
  175. if (!m) continue;
  176. if (m[1]) depth--;
  177. else depth++;
  178. if (!depth) break;
  179. }
  180. var endRow = row;
  181. if (endRow > startRow) {
  182. return new Range(startRow, startColumn, endRow, line.length);
  183. }
  184. };
  185. }).call(FoldMode.prototype);
  186. });
  187. ace.define("ace/mode/mel",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mel_highlight_rules","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  188. "use strict";
  189. var oop = acequire("../lib/oop");
  190. var TextMode = acequire("./text").Mode;
  191. var MELHighlightRules = acequire("./mel_highlight_rules").MELHighlightRules;
  192. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  193. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  194. var Mode = function() {
  195. this.HighlightRules = MELHighlightRules;
  196. this.$behaviour = new CstyleBehaviour();
  197. this.foldingRules = new CStyleFoldMode();
  198. };
  199. oop.inherits(Mode, TextMode);
  200. (function() {
  201. this.lineCommentStart = "//";
  202. this.blockComment = {start: "/*", end: "*/"};
  203. this.$id = "ace/mode/mel";
  204. }).call(Mode.prototype);
  205. exports.Mode = Mode;
  206. });