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.

335 lines
31 KiB

12 months ago
  1. ace.define("ace/mode/lsl_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. oop.inherits(LSLHighlightRules, TextHighlightRules);
  6. function LSLHighlightRules() {
  7. var keywordMapper = this.createKeywordMapper({
  8. "constant.language.float.lsl" : "DEG_TO_RAD|PI|PI_BY_TWO|RAD_TO_DEG|SQRT2|TWO_PI",
  9. "constant.language.integer.lsl": "ACTIVE|AGENT|AGENT_ALWAYS_RUN|AGENT_ATTACHMENTS|AGENT_AUTOPILOT|AGENT_AWAY|AGENT_BUSY|AGENT_BY_LEGACY_NAME|AGENT_BY_USERNAME|AGENT_CROUCHING|AGENT_FLYING|AGENT_IN_AIR|AGENT_LIST_PARCEL|AGENT_LIST_PARCEL_OWNER|AGENT_LIST_REGION|AGENT_MOUSELOOK|AGENT_ON_OBJECT|AGENT_SCRIPTED|AGENT_SITTING|AGENT_TYPING|AGENT_WALKING|ALL_SIDES|ANIM_ON|ATTACH_AVATAR_CENTER|ATTACH_BACK|ATTACH_BELLY|ATTACH_CHEST|ATTACH_CHIN|ATTACH_HEAD|ATTACH_HUD_BOTTOM|ATTACH_HUD_BOTTOM_LEFT|ATTACH_HUD_BOTTOM_RIGHT|ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2|ATTACH_HUD_TOP_CENTER|ATTACH_HUD_TOP_LEFT|ATTACH_HUD_TOP_RIGHT|ATTACH_LEAR|ATTACH_LEFT_PEC|ATTACH_LEYE|ATTACH_LFOOT|ATTACH_LHAND|ATTACH_LHIP|ATTACH_LLARM|ATTACH_LLLEG|ATTACH_LSHOULDER|ATTACH_LUARM|ATTACH_LULEG|ATTACH_MOUTH|ATTACH_NECK|ATTACH_NOSE|ATTACH_PELVIS|ATTACH_REAR|ATTACH_REYE|ATTACH_RFOOT|ATTACH_RHAND|ATTACH_RHIP|ATTACH_RIGHT_PEC|ATTACH_RLARM|ATTACH_RLLEG|ATTACH_RSHOULDER|ATTACH_RUARM|ATTACH_RULEG|AVOID_CHARACTERS|AVOID_DYNAMIC_OBSTACLES|AVOID_NONE|CAMERA_ACTIVE|CAMERA_BEHINDNESS_ANGLE|CAMERA_BEHINDNESS_LAG|CAMERA_DISTANCE|CAMERA_FOCUS|CAMERA_FOCUS_LAG|CAMERA_FOCUS_LOCKED|CAMERA_FOCUS_OFFSET|CAMERA_FOCUS_THRESHOLD|CAMERA_PITCH|CAMERA_POSITION|CAMERA_POSITION_LAG|CAMERA_POSITION_LOCKED|CAMERA_POSITION_THRESHOLD|CHANGED_ALLOWED_DROP|CHANGED_COLOR|CHANGED_INVENTORY|CHANGED_LINK|CHANGED_MEDIA|CHANGED_OWNER|CHANGED_REGION|CHANGED_REGION_START|CHANGED_SCALE|CHANGED_SHAPE|CHANGED_TELEPORT|CHANGED_TEXTURE|CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES|CHARACTER_AVOIDANCE_MODE|CHARACTER_CMD_JUMP|CHARACTER_CMD_SMOOTH_STOP|CHARACTER_CMD_STOP|CHARACTER_DESIRED_SPEED|CHARACTER_DESIRED_TURN_SPEED|CHARACTER_LENGTH|CHARACTER_MAX_ACCEL|CHARACTER_MAX_DECEL|CHARACTER_MAX_SPEED|CHARACTER_MAX_TURN_RADIUS|CHARACTER_ORIENTATION|CHARACTER_RADIUS|CHARACTER_STAY_WITHIN_PARCEL|CHARACTER_TYPE|CHARACTER_TYPE_A|CHARACTER_TYPE_B|CHARACTER_TYPE_C|CHARACTER_TYPE_D|CHARACTER_TYPE_NONE|CLICK_ACTION_BUY|CLICK_ACTION_NONE|CLICK_ACTION_OPEN|CLICK_ACTION_OPEN_MEDIA|CLICK_ACTION_PAY|CLICK_ACTION_PLAY|CLICK_ACTION_SIT|CLICK_ACTION_TOUCH|CONTENT_TYPE_ATOM|CONTENT_TYPE_FORM|CONTENT_TYPE_HTML|CONTENT_TYPE_JSON|CONTENT_TYPE_LLSD|CONTENT_TYPE_RSS|CONTENT_TYPE_TEXT|CONTENT_TYPE_XHTML|CONTENT_TYPE_XML|CONTROL_BACK|CONTROL_DOWN|CONTROL_FWD|CONTROL_LBUTTON|CONTROL_LEFT|CONTROL_ML_LBUTTON|CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT|CONTROL_UP|DATA_BORN|DATA_NAME|DATA_ONLINE|DATA_PAYINFO|DATA_SIM_POS|DATA_SIM_RATING|DATA_SIM_STATUS|DEBUG_CHANNEL|DENSITY|ERR_GENERIC|ERR_MALFORMED_PARAMS|ERR_PARCEL_PERMISSIONS|ERR_RUNTIME_PERMISSIONS|ERR_THROTTLED|ESTATE_ACCESS_ALLOWED_AGENT_ADD|ESTATE_ACCESS_ALLOWED_AGENT_REMOVE|ESTATE_ACCESS_ALLOWED_GROUP_ADD|ESTATE_ACCESS_ALLOWED_GROUP_REMOVE|ESTATE_ACCESS_BANNED_AGENT_ADD|ESTATE_ACCESS_BANNED_AGENT_REMOVE|FALSE|FORCE_DIRECT_PATH|FRICTION|GCNP_RADIUS|GCNP_STATIC|GRAVITY_MULTIPLIER|HORIZONTAL|HTTP_BODY_MAXLENGTH|HTTP_BODY_TRUNCATED|HTTP_CUSTOM_HEADER|HTTP_METHOD|HTTP_MIMETYPE|HTTP_PRAGMA_NO_CACHE|HTTP_VERBOSE_THROTTLE|HTTP_VERIFY_CERT|INVENTORY_ALL|INVENTORY_ANIMATION|INVENTORY_BODYPART|INVENTORY_CLOTHING|INVENTORY_GESTURE|INVENTORY_LANDMARK|INVENTORY_NONE|INVENTORY_NOTECARD|INVENTORY_OBJECT|INVENTORY_SCRIPT|INVENTORY_SOUND|INVENTORY_TEXTURE|JSON_APPEND|KFM_CMD_PAUSE|KFM_CMD_PLAY|KFM_CMD_SET_MODE|KFM_CMD_STOP|KFM_COMMAND|KFM_DATA|KFM_FORWARD|KFM_LOOP|KFM_MODE|KFM_PING_PONG|KFM_REVERSE|KFM_ROTATION|KFM_TRANSLATION|LAND_LEVEL|LAND_LOWER|LAND_NOISE|LAND_RAISE|LAND_REVERT|LAND_SMOOTH|LINK_ALL_CHILDREN|LINK_ALL_OTHERS|LINK_ROOT|LINK_SET|LINK_THIS|LIST_STAT_GEOMETRIC_MEAN|LIST_STAT_MAX|LIST_STAT_MEAN|LIST_STAT_MEDIAN|LIST_STAT_MIN|LIST_STAT_NUM_COUNT|LIST_STAT_RANGE|LIST_STAT_STD_DEV|LIST_STAT_SUM|LIST_STAT_SUM_SQUARES|LOOP|MASK_BASE|MASK_EVERYONE|MASK_GROUP|MASK_NEXT|MASK_OWNER|OBJECT_ATTACHED_POINT|OBJECT_BODY_SHAPE_TYPE|OBJECT_CHARACTER_TIME|OBJECT_CLICK_ACTION|OBJECT_CREATOR|OBJECT_DESC|OBJECT_GROUP|OBJECT_HOVER_HEIGHT|OBJECT_LAST_OWNER_ID|OBJECT_NAME|OBJECT_OWNER|OBJECT_PATHFINDING_TYPE|OBJECT_PHANTOM|OBJECT_PHYSICS|OBJECT_PHYSICS_COST|OBJECT_POS|OBJECT_PRIM_EQUIVALENCE|OBJECT_RENDER
  10. "constant.language.integer.boolean.lsl" : "FALSE|TRUE",
  11. "constant.language.quaternion.lsl" : "ZERO_ROTATION",
  12. "constant.language.string.lsl" : "EOF|JSON_ARRAY|JSON_DELETE|JSON_FALSE|JSON_INVALID|JSON_NULL|JSON_NUMBER|JSON_OBJECT|JSON_STRING|JSON_TRUE|NULL_KEY|TEXTURE_BLANK|TEXTURE_DEFAULT|TEXTURE_MEDIA|TEXTURE_PLYWOOD|TEXTURE_TRANSPARENT|URL_REQUEST_DENIED|URL_REQUEST_GRANTED",
  13. "constant.language.vector.lsl" : "TOUCH_INVALID_TEXCOORD|TOUCH_INVALID_VECTOR|ZERO_VECTOR",
  14. "invalid.broken.lsl": "LAND_LARGE_BRUSH|LAND_MEDIUM_BRUSH|LAND_SMALL_BRUSH",
  15. "invalid.deprecated.lsl" : "ATTACH_LPEC|ATTACH_RPEC|DATA_RATING|OBJECT_ATTACHMENT_GEOMETRY_BYTES|OBJECT_ATTACHMENT_SURFACE_AREA|PRIM_CAST_SHADOWS|PRIM_MATERIAL_LIGHT|PRIM_TYPE_LEGACY|PSYS_SRC_INNERANGLE|PSYS_SRC_OUTERANGLE|VEHICLE_FLAG_NO_FLY_UP|llClearExperiencePermissions|llCloud|llGetExperienceList|llMakeExplosion|llMakeFire|llMakeFountain|llMakeSmoke|llRemoteDataSetRegion|llSound|llSoundPreload|llXorBase64Strings|llXorBase64StringsCorrect",
  16. "invalid.illegal.lsl": "event",
  17. "invalid.unimplemented.lsl": "CHARACTER_MAX_ANGULAR_ACCEL|CHARACTER_MAX_ANGULAR_SPEED|CHARACTER_TURN_SPEED_MULTIPLIER|PERMISSION_CHANGE_JOINTS|PERMISSION_CHANGE_PERMISSIONS|PERMISSION_EXPERIENCE|PERMISSION_RELEASE_OWNERSHIP|PERMISSION_REMAP_CONTROLS|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|llCollisionSprite|llPointAt|llRefreshPrimURL|llReleaseCamera|llRemoteLoadScript|llSetPrimURL|llStopPointAt|llTakeCamera",
  18. "reserved.godmode.lsl": "llGodLikeRezObject|llSetInventoryPermMask|llSetObjectPermMask",
  19. "reserved.log.lsl" : "print",
  20. "keyword.control.lsl" : "do|else|for|if|jump|return|while",
  21. "storage.type.lsl" : "float|integer|key|list|quaternion|rotation|string|vector",
  22. "support.function.lsl": "llAbs|llAcos|llAddToLandBanList|llAddToLandPassList|llAdjustSoundVolume|llAgentInExperience|llAllowInventoryDrop|llAngleBetween|llApplyImpulse|llApplyRotationalImpulse|llAsin|llAtan2|llAttachToAvatar|llAttachToAvatarTemp|llAvatarOnLinkSitTarget|llAvatarOnSitTarget|llAxes2Rot|llAxisAngle2Rot|llBase64ToInteger|llBase64ToString|llBreakAllLinks|llBreakLink|llCSV2List|llCastRay|llCeil|llClearCameraParams|llClearLinkMedia|llClearPrimMedia|llCloseRemoteDataChannel|llCollisionFilter|llCollisionSound|llCos|llCreateCharacter|llCreateKeyValue|llCreateLink|llDataSizeKeyValue|llDeleteCharacter|llDeleteKeyValue|llDeleteSubList|llDeleteSubString|llDetachFromAvatar|llDetectedGrab|llDetectedGroup|llDetectedKey|llDetectedLinkNumber|llDetectedName|llDetectedOwner|llDetectedPos|llDetectedRot|llDetectedTouchBinormal|llDetectedTouchFace|llDetectedTouchNormal|llDetectedTouchPos|llDetectedTouchST|llDetectedTouchUV|llDetectedType|llDetectedVel|llDialog|llDie|llDumpList2String|llEdgeOfWorld|llEjectFromLand|llEmail|llEscapeURL|llEuler2Rot|llEvade|llExecCharacterCmd|llFabs|llFleeFrom|llFloor|llForceMouselook|llFrand|llGenerateKey|llGetAccel|llGetAgentInfo|llGetAgentLanguage|llGetAgentList|llGetAgentSize|llGetAlpha|llGetAndResetTime|llGetAnimation|llGetAnimationList|llGetAnimationOverride|llGetAttached|llGetAttachedList|llGetBoundingBox|llGetCameraPos|llGetCameraRot|llGetCenterOfMass|llGetClosestNavPoint|llGetColor|llGetCreator|llGetDate|llGetDisplayName|llGetEnergy|llGetEnv|llGetExperienceDetails|llGetExperienceErrorMessage|llGetForce|llGetFreeMemory|llGetFreeURLs|llGetGMTclock|llGetGeometricCenter|llGetHTTPHeader|llGetInventoryCreator|llGetInventoryKey|llGetInventoryName|llGetInventoryNumber|llGetInventoryPermMask|llGetInventoryType|llGetKey|llGetLandOwnerAt|llGetLinkKey|llGetLinkMedia|llGetLinkName|llGetLinkNumber|llGetLinkNumberOfSides|llGetLinkPrimitiveParams|llGetListEntryType|llGetListLength|llGetLocalPos|llGetLocalRot|llGetMass|llGetMassMKS|llGetMaxScaleFactor|llGetMemoryLimit|llGetMinScaleFactor|llGetNextEmail|llGetNotecardLine|llGetNumberOfNotecardLines|llGetNumberOfPrims|llGetNumberOfSides|llGetObjectDesc|llGetObjectDetails|llGetObjectMass|llGetObjectName|llGetObjectPermMask|llGetObjectPrimCount|llGetOmega|llGetOwner|llGetOwnerKey|llGetParcelDetails|llGetParcelFlags|llGetParcelMaxPrims|llGetParcelMusicURL|llGetParcelPrimCount|llGetParcelPrimOwners|llGetPermissions|llGetPermissionsKey|llGetPhysicsMaterial|llGetPos|llGetPrimMediaParams|llGetPrimitiveParams|llGetRegionAgentCount|llGetRegionCorner|llGetRegionFPS|llGetRegionFlags|llGetRegionName|llGetRegionTimeDilation|llGetRootPosition|llGetRootRotation|llGetRot|llGetSPMaxMemory|llGetScale|llGetScriptName|llGetScriptState|llGetSimStats|llGetSimulatorHostname|llGetStartParameter|llGetStaticPath|llGetStatus|llGetSubString|llGetSunDirection|llGetTexture|llGetTextureOffset|llGetTextureRot|llGetTextureScale|llGetTime|llGetTimeOfDay|llGetTimestamp|llGetTorque|llGetUnixTime|llGetUsedMemory|llGetUsername|llGetVel|llGetWallclock|llGiveInventory|llGiveInventoryList|llGiveMoney|llGround|llGroundContour|llGroundNormal|llGroundRepel|llGroundSlope|llHTTPRequest|llHTTPResponse|llInsertString|llInstantMessage|llIntegerToBase64|llJson2List|llJsonGetValue|llJsonSetValue|llJsonValueType|llKey2Name|llKeyCountKeyValue|llKeysKeyValue|llLinkParticleSystem|llLinkSitTarget|llList2CSV|llList2Float|llList2Integer|llList2Json|llList2Key|llList2List|llList2ListStrided|llList2Rot|llList2String|llList2Vector|llListFindList|llListInsertList|llListRandomize|llListReplaceList|llListSort|llListStatistics|llListen|llListenControl|llListenRemove|llLoadURL|llLog|llLog10|llLookAt|llLoopSound|llLoopSoundMaster|llLoopSoundSlave|llMD5String|llManageEstateAccess|llMapDestination|llMessageLinked|llMinEventDelay|llModPow|llModifyLand|llMoveToTarget|llNavigateTo|llOffsetTexture|llOpenRemoteDataChannel|llOverMyLand|llOwnerSay|llParcelMediaCommandList|llParcelMediaQuery|llParseString2List|llParseStringKeepNulls|llParticleSystem|llPassCollisions|llPassTouches|llPatrolPoints|llPlaySound|llPlaySoundSlave|llPo
  23. "support.function.event.lsl" : "at_rot_target|at_target|attach|changed|collision|collision_end|collision_start|control|dataserver|email|experience_permissions|experience_permissions_denied|http_request|http_response|land_collision|land_collision_end|land_collision_start|link_message|listen|money|moving_end|moving_start|no_sensor|not_at_rot_target|not_at_target|object_rez|on_rez|path_update|remote_data|run_time_permissions|sensor|state_entry|state_exit|timer|touch|touch_end|touch_start|transaction_result"
  24. }, "identifier");
  25. this.$rules = {
  26. "start" : [
  27. {
  28. token : "comment.line.double-slash.lsl",
  29. regex : "\\/\\/.*$"
  30. }, {
  31. token : "comment.block.begin.lsl",
  32. regex : "\\/\\*",
  33. next : "comment"
  34. }, {
  35. token : "string.quoted.double.lsl",
  36. start : '"',
  37. end : '"',
  38. next : [{
  39. token : "constant.character.escape.lsl",
  40. regex : /\\[tn"\\]/
  41. }]
  42. }, {
  43. token : "constant.numeric.lsl",
  44. regex : "(0[xX][0-9a-fA-F]+|[+-]?[0-9]+(?:(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)?)\\b"
  45. }, {
  46. token : "entity.name.state.lsl",
  47. regex : "\\b((state)\\s+[A-Za-z_]\\w*|default)\\b"
  48. }, {
  49. token : keywordMapper,
  50. regex : "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
  51. }, {
  52. token : "support.function.user-defined.lsl",
  53. regex : /\b([a-zA-Z_]\w*)(?=\(.*?\))/
  54. }, {
  55. token : "keyword.operator.lsl",
  56. regex : "\\+\\+|\\-\\-|<<|>>|&&?|\\|\\|?|\\^|~|[!%<>=*+\\-\\/]=?"
  57. }, {
  58. token : "invalid.illegal.keyword.operator.lsl",
  59. regex : ":=?"
  60. }, {
  61. token : "punctuation.operator.lsl",
  62. regex : "\\,|\\;"
  63. }, {
  64. token : "paren.lparen.lsl",
  65. regex : "[\\[\\(\\{]"
  66. }, {
  67. token : "paren.rparen.lsl",
  68. regex : "[\\]\\)\\}]"
  69. }, {
  70. token : "text.lsl",
  71. regex : "\\s+"
  72. }
  73. ],
  74. "comment" : [
  75. {
  76. token : "comment.block.end.lsl",
  77. regex : "\\*\\/",
  78. next : "start"
  79. }, {
  80. defaultToken : "comment.block.lsl"
  81. }
  82. ]
  83. };
  84. this.normalizeRules();
  85. }
  86. exports.LSLHighlightRules = LSLHighlightRules;
  87. });
  88. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  89. "use strict";
  90. var Range = acequire("../range").Range;
  91. var MatchingBraceOutdent = function() {};
  92. (function() {
  93. this.checkOutdent = function(line, input) {
  94. if (! /^\s+$/.test(line))
  95. return false;
  96. return /^\s*\}/.test(input);
  97. };
  98. this.autoOutdent = function(doc, row) {
  99. var line = doc.getLine(row);
  100. var match = line.match(/^(\s*\})/);
  101. if (!match) return 0;
  102. var column = match[1].length;
  103. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  104. if (!openBracePos || openBracePos.row == row) return 0;
  105. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  106. doc.replace(new Range(row, 0, row, column-1), indent);
  107. };
  108. this.$getIndent = function(line) {
  109. return line.match(/^\s*/)[0];
  110. };
  111. }).call(MatchingBraceOutdent.prototype);
  112. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  113. });
  114. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  115. "use strict";
  116. var oop = acequire("../../lib/oop");
  117. var Range = acequire("../../range").Range;
  118. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  119. var FoldMode = exports.FoldMode = function(commentRegex) {
  120. if (commentRegex) {
  121. this.foldingStartMarker = new RegExp(
  122. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  123. );
  124. this.foldingStopMarker = new RegExp(
  125. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  126. );
  127. }
  128. };
  129. oop.inherits(FoldMode, BaseFoldMode);
  130. (function() {
  131. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  132. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  133. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  134. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  135. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  136. this._getFoldWidgetBase = this.getFoldWidget;
  137. this.getFoldWidget = function(session, foldStyle, row) {
  138. var line = session.getLine(row);
  139. if (this.singleLineBlockCommentRe.test(line)) {
  140. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  141. return "";
  142. }
  143. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  144. if (!fw && this.startRegionRe.test(line))
  145. return "start"; // lineCommentRegionStart
  146. return fw;
  147. };
  148. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  149. var line = session.getLine(row);
  150. if (this.startRegionRe.test(line))
  151. return this.getCommentRegionBlock(session, line, row);
  152. var match = line.match(this.foldingStartMarker);
  153. if (match) {
  154. var i = match.index;
  155. if (match[1])
  156. return this.openingBracketBlock(session, match[1], row, i);
  157. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  158. if (range && !range.isMultiLine()) {
  159. if (forceMultiline) {
  160. range = this.getSectionRange(session, row);
  161. } else if (foldStyle != "all")
  162. range = null;
  163. }
  164. return range;
  165. }
  166. if (foldStyle === "markbegin")
  167. return;
  168. var match = line.match(this.foldingStopMarker);
  169. if (match) {
  170. var i = match.index + match[0].length;
  171. if (match[1])
  172. return this.closingBracketBlock(session, match[1], row, i);
  173. return session.getCommentFoldRange(row, i, -1);
  174. }
  175. };
  176. this.getSectionRange = function(session, row) {
  177. var line = session.getLine(row);
  178. var startIndent = line.search(/\S/);
  179. var startRow = row;
  180. var startColumn = line.length;
  181. row = row + 1;
  182. var endRow = row;
  183. var maxRow = session.getLength();
  184. while (++row < maxRow) {
  185. line = session.getLine(row);
  186. var indent = line.search(/\S/);
  187. if (indent === -1)
  188. continue;
  189. if (startIndent > indent)
  190. break;
  191. var subRange = this.getFoldWidgetRange(session, "all", row);
  192. if (subRange) {
  193. if (subRange.start.row <= startRow) {
  194. break;
  195. } else if (subRange.isMultiLine()) {
  196. row = subRange.end.row;
  197. } else if (startIndent == indent) {
  198. break;
  199. }
  200. }
  201. endRow = row;
  202. }
  203. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  204. };
  205. this.getCommentRegionBlock = function(session, line, row) {
  206. var startColumn = line.search(/\s*$/);
  207. var maxRow = session.getLength();
  208. var startRow = row;
  209. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  210. var depth = 1;
  211. while (++row < maxRow) {
  212. line = session.getLine(row);
  213. var m = re.exec(line);
  214. if (!m) continue;
  215. if (m[1]) depth--;
  216. else depth++;
  217. if (!depth) break;
  218. }
  219. var endRow = row;
  220. if (endRow > startRow) {
  221. return new Range(startRow, startColumn, endRow, line.length);
  222. }
  223. };
  224. }).call(FoldMode.prototype);
  225. });
  226. ace.define("ace/mode/lsl",["require","exports","module","ace/mode/lsl_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/text","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/lib/oop"], function(acequire, exports, module) {
  227. "use strict";
  228. var Rules = acequire("./lsl_highlight_rules").LSLHighlightRules;
  229. var Outdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  230. var Range = acequire("../range").Range;
  231. var TextMode = acequire("./text").Mode;
  232. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  233. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  234. var oop = acequire("../lib/oop");
  235. var Mode = function() {
  236. this.HighlightRules = Rules;
  237. this.$outdent = new Outdent();
  238. this.$behaviour = new CstyleBehaviour();
  239. this.foldingRules = new CStyleFoldMode();
  240. };
  241. oop.inherits(Mode, TextMode);
  242. (function() {
  243. this.lineCommentStart = ["//"];
  244. this.blockComment = {
  245. start: "/*",
  246. end: "*/"
  247. };
  248. this.getNextLineIndent = function(state, line, tab) {
  249. var indent = this.$getIndent(line);
  250. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  251. var tokens = tokenizedLine.tokens;
  252. var endState = tokenizedLine.state;
  253. if (tokens.length && tokens[tokens.length-1].type === "comment.block.lsl") {
  254. return indent;
  255. }
  256. if (state === "start") {
  257. var match = line.match(/^.*[\{\(\[]\s*$/);
  258. if (match) {
  259. indent += tab;
  260. }
  261. }
  262. return indent;
  263. };
  264. this.checkOutdent = function(state, line, input) {
  265. return this.$outdent.checkOutdent(line, input);
  266. };
  267. this.autoOutdent = function(state, doc, row) {
  268. this.$outdent.autoOutdent(doc, row);
  269. };
  270. this.$id = "ace/mode/lsl";
  271. }).call(Mode.prototype);
  272. exports.Mode = Mode;
  273. });