mode-qml.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. ace.define("ace/mode/qml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var QmlHighlightRules = function() {
  6. var keywordMapper = this.createKeywordMapper({
  7. "variable.language":
  8. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  9. "Namespace|QName|XML|XMLList|" + // E4X
  10. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  11. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  12. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  13. "SyntaxError|TypeError|URIError|" +
  14. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  15. "isNaN|parseFloat|parseInt|" +
  16. "JSON|Math|" + // Other
  17. "this|arguments|prototype|window|document" , // Pseudo
  18. "keyword":
  19. "const|yield|import|get|set|async|await|" +
  20. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  21. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  22. "__parent__|__count__|escape|unescape|with|__proto__|" +
  23. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|" +
  24. "readonly|string|int|bool|date|color|url|real|double|var|variant|" +
  25. "height|width|anchors|parent|" +
  26. "Abstract3DSeries|AbstractActionInput|AbstractAnimation|AbstractAxis|AbstractAxis3D|AbstractAxisInput|" +
  27. "AbstractBarSeries|AbstractButton|AbstractClipAnimator|AbstractClipBlendNode|AbstractDataProxy|AbstractGraph3D|" +
  28. "AbstractInputHandler3D|AbstractPhysicalDevice|AbstractRayCaster|AbstractSeries|AbstractSkeleton|AbstractTextureImage|" +
  29. "Accelerometer|AccelerometerReading|Accessible|Action|ActionGroup|ActionInput|" +
  30. "AdditiveClipBlend|Address|Affector|Age|AlphaCoverage|AlphaTest|" +
  31. "Altimeter|AltimeterReading|AmbientLightReading|AmbientLightSensor|AmbientTemperatureReading|AmbientTemperatureSensor|" +
  32. "AnalogAxisInput|AnchorAnimation|AnchorChanges|AngleDirection|AnimatedImage|AnimatedSprite|" +
  33. "Animation|AnimationController|AnimationGroup|Animator|ApplicationWindow|ApplicationWindowStyle|" +
  34. "AreaSeries|Armature|AttenuationModelInverse|AttenuationModelLinear|Attractor|Attribute|" +
  35. "Audio|AudioCategory|AudioEngine|AudioListener|AudioSample|AuthenticationDialogRequest|" +
  36. "Axis|AxisAccumulator|AxisSetting|BackspaceKey|Bar3DSeries|BarCategoryAxis|" +
  37. "BarDataProxy|BarSeries|BarSet|Bars3D|BaseKey|Behavior|" +
  38. "Binding|Blend|BlendEquation|BlendEquationArguments|BlendedClipAnimator|BlitFramebuffer|" +
  39. "BluetoothDiscoveryModel|BluetoothService|BluetoothSocket|BorderImage|BorderImageMesh|BoxPlotSeries|" +
  40. "BoxSet|BrightnessContrast|Buffer|BusyIndicator|BusyIndicatorStyle|Button|" +
  41. "ButtonAxisInput|ButtonGroup|ButtonStyle|Calendar|CalendarStyle|Camera|" +
  42. "Camera3D|CameraCapabilities|CameraCapture|CameraExposure|CameraFlash|CameraFocus|" +
  43. "CameraImageProcessing|CameraLens|CameraRecorder|CameraSelector|CandlestickSeries|CandlestickSet|" +
  44. "Canvas|Canvas3D|Canvas3DAbstractObject|Canvas3DActiveInfo|Canvas3DBuffer|Canvas3DContextAttributes|" +
  45. "Canvas3DFrameBuffer|Canvas3DProgram|Canvas3DRenderBuffer|Canvas3DShader|Canvas3DShaderPrecisionFormat|Canvas3DTexture|" +
  46. "Canvas3DTextureProvider|Canvas3DUniformLocation|CanvasGradient|CanvasImageData|CanvasPixelArray|Category|" +
  47. "CategoryAxis|CategoryAxis3D|CategoryModel|CategoryRange|ChangeLanguageKey|ChartView|" +
  48. "CheckBox|CheckBoxStyle|CheckDelegate|CircularGauge|CircularGaugeStyle|ClearBuffers|" +
  49. "ClipAnimator|ClipPlane|CloseEvent|ColorAnimation|ColorDialog|ColorDialogRequest|" +
  50. "ColorGradient|ColorGradientStop|ColorMask|ColorOverlay|Colorize|Column|" +
  51. "ColumnLayout|ComboBox|ComboBoxStyle|Compass|CompassReading|Component|Component3D|" +
  52. "ComputeCommand|ConeGeometry|ConeMesh|ConicalGradient|Connections|ContactDetail|" +
  53. "ContactDetails|Container|Context2D|Context3D|ContextMenuRequest|Control|" +
  54. "CoordinateAnimation|CuboidGeometry|CuboidMesh|CullFace|CumulativeDirection|" +
  55. "Custom3DItem|Custom3DLabel|Custom3DVolume|CustomParticle|CylinderGeometry|CylinderMesh|" +
  56. "Date|DateTimeAxis|DelayButton|DelayButtonStyle|DelegateChoice|DelegateChooser|DelegateModel|" +
  57. "DelegateModelGroup|DepthTest|Desaturate|Dial|DialStyle|Dialog|DialogButtonBox|DiffuseMapMaterial|" +
  58. "DiffuseSpecularMapMaterial|DiffuseSpecularMaterial|Direction|DirectionalBlur|DirectionalLight|DispatchCompute|" +
  59. "Displace|DistanceReading|DistanceSensor|Dithering|DoubleValidator|Drag|DragEvent|DragHandler|Drawer|DropArea|" +
  60. "DropShadow|DwmFeatures|DynamicParameter|EditorialModel|Effect|EllipseShape|Emitter|EnterKey|EnterKeyAction|" +
  61. "Entity|EntityLoader|EnvironmentLight|EventConnection|EventPoint|EventTouchPoint|ExclusiveGroup|ExtendedAttributes|" +
  62. "ExtrudedTextGeometry|ExtrudedTextMesh|FastBlur|FileDialog|FileDialogRequest|FillerKey|FilterKey|FinalState|" +
  63. "FirstPersonCameraController|Flickable|Flipable|Flow|FocusScope|FolderListModel|FontDialog|FontLoader|" +
  64. "FontMetrics|FormValidationMessageRequest|ForwardRenderer|Frame|FrameAction|FrameGraphNode|Friction|" +
  65. "FrontFace|FrustumCulling|FullScreenRequest|GLStateDumpExt|GammaAdjust|Gauge|GaugeStyle|GaussianBlur|" +
  66. "GeocodeModel|Geometry|GeometryRenderer|GestureEvent|Glow|GoochMaterial|Gradient|GradientStop|GraphicsApiFilter|" +
  67. "GraphicsInfo|Gravity|Grid|GridLayout|GridMesh|GridView|GroupBox|GroupGoal|Gyroscope|GyroscopeReading|HBarModelMapper|" +
  68. "HBoxPlotModelMapper|HCandlestickModelMapper|HPieModelMapper|HXYModelMapper|HandlerPoint|HandwritingInputPanel|" +
  69. "HandwritingModeKey|HeightMapSurfaceDataProxy|HideKeyboardKey|HistoryState|HolsterReading|HolsterSensor|HorizontalBarSeries|" +
  70. "|HorizontalPercentBarSeries|HorizontalStackedBarSeries|HoverHandler|HueSaturation|HumidityReading|HumiditySensor|" +
  71. "IRProximityReading|IRProximitySensor|Icon|Image|ImageModel|ImageParticle|InnerShadow|InputChord|InputContext|InputEngine|" +
  72. "InputHandler3D|InputMethod|InputModeKey|InputPanel|InputSequence|InputSettings|Instantiator|IntValidator|InvokedServices|" +
  73. "Item|ItemDelegate|ItemGrabResult|ItemModelBarDataProxy|ItemModelScatterDataProxy|ItemModelSurfaceDataProxy|ItemParticle|" +
  74. "ItemSelectionModel|IviApplication|IviSurface|JavaScriptDialogRequest|Joint|JumpList|JumpListCategory|JumpListDestination|" +
  75. "JumpListLink|JumpListSeparator|Key|KeyEvent|KeyIcon|KeyNavigation|KeyPanel|KeyboardColumn|KeyboardDevice|KeyboardHandler|" +
  76. "KeyboardLayout|KeyboardLayoutLoader|KeyboardRow|KeyboardStyle|KeyframeAnimation|Keys|Label|Layer|LayerFilter|Layout|" +
  77. "LayoutMirroring|Legend|LerpBlend|LevelAdjust|LevelOfDetail|LevelOfDetailBoundingSphere|LevelOfDetailLoader|" +
  78. "LevelOfDetailSwitch|LidReading|LidSensor|Light|Light3D|LightReading|LightSensor|LineSeries|LineShape|LineWidth|" +
  79. "LinearGradient|ListElement|ListModel|ListView|Loader|Locale|Location|LogValueAxis|LogValueAxis3DFormatter|LoggingCategory|" +
  80. "LogicalDevice|Magnetometer|MagnetometerReading|Map|MapCircle|MapCircleObject|MapCopyrightNotice|MapGestureArea|MapIconObject|" +
  81. "MapItemGroup|MapItemView|MapObjectView|MapParameter|MapPinchEvent|MapPolygon|MapPolygonObject|MapPolyline|MapPolylineObject|" +
  82. "MapQuickItem|MapRectangle|MapRoute|MapRouteObject|MapType|Margins|MaskShape|MaskedBlur|Material|Matrix4x4|MediaPlayer|" +
  83. "MemoryBarrier|Menu|MenuBar|MenuBarItem|MenuBarStyle|MenuItem|MenuSeparator|MenuStyle|Mesh|MessageDialog|ModeKey|MorphTarget|" +
  84. "MorphingAnimation|MouseArea|MouseDevice|MouseEvent|MouseHandler|MultiPointHandler|MultiPointTouchArea|MultiSampleAntiAliasing|" +
  85. "Navigator|NdefFilter|NdefMimeRecord|NdefRecord|NdefTextRecord|NdefUriRecord|NearField|NoDepthMask|NoDraw|Node|NodeInstantiator|" +
  86. "NormalDiffuseMapAlphaMaterial|NormalDiffuseMapMaterial|NormalDiffuseSpecularMapMaterial|Number|NumberAnimation|NumberKey|Object3D|" +
  87. "ObjectModel|ObjectPicker|OpacityAnimator|OpacityMask|OpenGLInfo|OrbitCameraController|OrientationReading|OrientationSensor|Overlay|" +
  88. "Package|Page|PageIndicator|Pane|ParallelAnimation|Parameter|ParentAnimation|ParentChange|Particle|ParticleGroup|ParticlePainter|" +
  89. "ParticleSystem|Path|PathAngleArc|PathAnimation|PathArc|PathAttribute|PathCubic|PathCurve|PathElement|PathInterpolator|PathLine|" +
  90. "PathMove|PathPercent|PathQuad|PathSvg|PathView|PauseAnimation|PerVertexColorMaterial|PercentBarSeries|PhongAlphaMaterial|" +
  91. "PhongMaterial|PickEvent|PickLineEvent|PickPointEvent|PickTriangleEvent|PickingSettings|Picture|PieMenu|PieMenuStyle|PieSeries|" +
  92. "PieSlice|PinchArea|PinchEvent|PinchHandler|Place|PlaceAttribute|PlaceSearchModel|PlaceSearchSuggestionModel|PlaneGeometry|" +
  93. "PlaneMesh|PlayVariation|Playlist|PlaylistItem|Plugin|PluginParameter|PointDirection|PointHandler|PointLight|PointSize|" +
  94. "PointerDevice|PointerDeviceHandler|PointerEvent|PointerHandler|PolarChartView|PolygonOffset|Popup|Position|PositionSource|" +
  95. "Positioner|PressureReading|PressureSensor|Product|ProgressBar|ProgressBarStyle|PropertyAction|PropertyAnimation|PropertyChanges|" +
  96. "ProximityFilter|ProximityReading|ProximitySensor|QAbstractState|QAbstractTransition|QSignalTransition|" +
  97. "QVirtualKeyboardSelectionListModel|Qt|QtMultimedia|QtObject|QtPositioning|QuaternionAnimation|QuotaRequest|RadialBlur|" +
  98. "RadialGradient|Radio|RadioButton|RadioButtonStyle|RadioData|RadioDelegate|RangeSlider|Ratings|RayCaster|Rectangle|" +
  99. "RectangleShape|RectangularGlow|RecursiveBlur|RegExpValidator|RegisterProtocolHandlerRequest|RenderCapture|" +
  100. "RenderCaptureReply|RenderPass|RenderPassFilter|RenderSettings|RenderState|RenderStateSet|RenderSurfaceSelector|" +
  101. "RenderTarget|RenderTargetOutput|RenderTargetSelector|Repeater|ReviewModel|Rotation|RotationAnimation|RotationAnimator|" +
  102. "RotationReading|RotationSensor|RoundButton|Route|RouteLeg|RouteManeuver|RouteModel|RouteQuery|RouteSegment|Row|" +
  103. "RowLayout|Scale|ScaleAnimator|Scatter3D|Scatter3DSeries|ScatterDataProxy|ScatterSeries|Scene2D|Scene3D|SceneLoader|" +
  104. "ScissorTest|Screen|ScreenRayCaster|ScriptAction|ScrollBar|ScrollIndicator|ScrollView|ScrollViewStyle|ScxmlStateMachine|" +
  105. "SeamlessCubemap|SelectionListItem|Sensor|SensorGesture|SensorGlobal|SensorReading|SequentialAnimation|Settings|" +
  106. "SettingsStore|ShaderEffect|ShaderEffectSource|ShaderProgram|ShaderProgramBuilder|Shape|ShellSurface|ShellSurfaceItem|" +
  107. "ShiftHandler|ShiftKey|Shortcut|SignalSpy|SignalTransition|SinglePointHandler|Skeleton|SkeletonLoader|Slider|SliderStyle|" +
  108. "SmoothedAnimation|SortPolicy|Sound|SoundEffect|SoundInstance|SpaceKey|SphereGeometry|SphereMesh|SpinBox|SpinBoxStyle|" +
  109. "SplineSeries|SplitView|SpotLight|SpringAnimation|Sprite|SpriteGoal|SpriteSequence|Stack|StackLayout|StackView|" +
  110. "StackViewDelegate|StackedBarSeries|State|StateChangeScript|StateGroup|StateMachine|StateMachineLoader|StatusBar|" +
  111. "StatusBarStyle|StatusIndicator|StatusIndicatorStyle|StencilMask|StencilOperation|StencilOperationArguments|StencilTest|" +
  112. "StencilTestArguments|Store|String|Supplier|Surface3D|Surface3DSeries|SurfaceDataProxy|SwipeDelegate|SwipeView|Switch|" +
  113. "SwitchDelegate|SwitchStyle|SymbolModeKey|SystemPalette|Tab|TabBar|TabButton|TabView|TabViewStyle|TableView|TableViewColumn|" +
  114. "TableViewStyle|TapHandler|TapReading|TapSensor|TargetDirection|TaskbarButton|Technique|TechniqueFilter|TestCase|Text|TextArea|" +
  115. "TextAreaStyle|TextEdit|TextField|TextFieldStyle|TextInput|TextMetrics|TextureImage|TextureImageFactory|Theme3D|ThemeColor|" +
  116. "ThresholdMask|ThumbnailToolBar|ThumbnailToolButton|TiltReading|TiltSensor|TimeoutTransition|Timer|ToggleButton|" +
  117. "ToggleButtonStyle|ToolBar|ToolBarStyle|ToolButton|ToolSeparator|ToolTip|Torch|TorusGeometry|TorusMesh|TouchEventSequence|" +
  118. "TouchInputHandler3D|TouchPoint|Trace|TraceCanvas|TraceInputArea|TraceInputKey|TraceInputKeyPanel|TrailEmitter|Transaction|" +
  119. "Transform|Transition|Translate|TreeView|TreeViewStyle|Tumbler|TumblerColumn|TumblerStyle|Turbulence|UniformAnimator|User|" +
  120. "VBarModelMapper|VBoxPlotModelMapper|VCandlestickModelMapper|VPieModelMapper|VXYModelMapper|ValueAxis|ValueAxis3D|" +
  121. "ValueAxis3DFormatter|Vector3dAnimation|VertexBlendAnimation|Video|VideoOutput|ViewTransition|Viewport|" +
  122. "VirtualKeyboardSettings|Wander|WavefrontMesh|WaylandClient|WaylandCompositor|WaylandHardwareLayer|" +
  123. "WaylandOutput|WaylandQuickItem|WaylandSeat|WaylandSurface|WaylandView|Waypoint|" +
  124. "WebChannel|WebEngine|WebEngineAction|WebEngineCertificateError|WebEngineDownloadItem|WebEngineHistory|" +
  125. "WebEngineHistoryListModel|WebEngineLoadRequest|WebEngineNavigationRequest|WebEngineNewViewRequest|WebEngineProfile|WebEngineScript|" +
  126. "WebEngineSettings|WebEngineView|WebSocket|WebSocketServer|WebView|WebViewLoadRequest|" +
  127. "WheelEvent|Window|WlShell|WlShellSurface|WorkerScript|XAnimator|" +
  128. "XYPoint|XYSeries|XdgDecorationManagerV1|XdgPopup|XdgPopupV5|XdgPopupV6|" +
  129. "XdgShell|XdgShellV5|XdgShellV6|XdgSurface|XdgSurfaceV5|XdgSurfaceV6|" +
  130. "XdgToplevel|XdgToplevelV6|XmlListModel|XmlRole|YAnimator|ZoomBlur",
  131. "storage.type":
  132. "const|let|var|function|" + // js
  133. "property|", // qml
  134. "constant.language":
  135. "null|Infinity|NaN|undefined",
  136. "support.function":
  137. "print|console\\.log",
  138. "constant.language.boolean": "true|false"
  139. }, "identifier");
  140. this.$rules = {
  141. "start" : [
  142. {
  143. token : "string", // single line
  144. regex : '"',
  145. next : "string"
  146. }, {
  147. token : "constant.numeric", // hex
  148. regex : "0[xX][0-9a-fA-F]+\\b"
  149. }, {
  150. token : "constant.numeric", // float
  151. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  152. }, {
  153. token : "constant.language.boolean",
  154. regex : "(?:true|false)\\b"
  155. }, {
  156. token : "text",
  157. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  158. }, {
  159. token : "comment",
  160. regex : "\\/\\/.*$"
  161. }, {
  162. token : "comment.start",
  163. regex : "\\/\\*",
  164. next : "comment"
  165. }, {
  166. token : "paren.lparen",
  167. regex : "[[({]"
  168. }, {
  169. token : "paren.rparen",
  170. regex : "[\\])}]"
  171. }, {
  172. token : "text",
  173. regex : "\\s+"
  174. }, {
  175. token : keywordMapper,
  176. regex : "\\b\\w+\\b"
  177. }
  178. ],
  179. "string" : [
  180. {
  181. token : "constant.language.escape",
  182. regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
  183. }, {
  184. token : "string",
  185. regex : '"|$',
  186. next : "start"
  187. }, {
  188. defaultToken : "string"
  189. }
  190. ],
  191. "comment" : [
  192. {
  193. token : "comment.end",
  194. regex : "\\*\\/",
  195. next : "start"
  196. }, {
  197. defaultToken: "comment"
  198. }
  199. ]
  200. };
  201. };
  202. oop.inherits(QmlHighlightRules, TextHighlightRules);
  203. exports.QmlHighlightRules = QmlHighlightRules;
  204. });
  205. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  206. "use strict";
  207. var oop = require("../../lib/oop");
  208. var Range = require("../../range").Range;
  209. var BaseFoldMode = require("./fold_mode").FoldMode;
  210. var FoldMode = exports.FoldMode = function(commentRegex) {
  211. if (commentRegex) {
  212. this.foldingStartMarker = new RegExp(
  213. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  214. );
  215. this.foldingStopMarker = new RegExp(
  216. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  217. );
  218. }
  219. };
  220. oop.inherits(FoldMode, BaseFoldMode);
  221. (function() {
  222. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  223. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  224. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  225. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  226. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  227. this._getFoldWidgetBase = this.getFoldWidget;
  228. this.getFoldWidget = function(session, foldStyle, row) {
  229. var line = session.getLine(row);
  230. if (this.singleLineBlockCommentRe.test(line)) {
  231. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  232. return "";
  233. }
  234. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  235. if (!fw && this.startRegionRe.test(line))
  236. return "start"; // lineCommentRegionStart
  237. return fw;
  238. };
  239. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  240. var line = session.getLine(row);
  241. if (this.startRegionRe.test(line))
  242. return this.getCommentRegionBlock(session, line, row);
  243. var match = line.match(this.foldingStartMarker);
  244. if (match) {
  245. var i = match.index;
  246. if (match[1])
  247. return this.openingBracketBlock(session, match[1], row, i);
  248. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  249. if (range && !range.isMultiLine()) {
  250. if (forceMultiline) {
  251. range = this.getSectionRange(session, row);
  252. } else if (foldStyle != "all")
  253. range = null;
  254. }
  255. return range;
  256. }
  257. if (foldStyle === "markbegin")
  258. return;
  259. var match = line.match(this.foldingStopMarker);
  260. if (match) {
  261. var i = match.index + match[0].length;
  262. if (match[1])
  263. return this.closingBracketBlock(session, match[1], row, i);
  264. return session.getCommentFoldRange(row, i, -1);
  265. }
  266. };
  267. this.getSectionRange = function(session, row) {
  268. var line = session.getLine(row);
  269. var startIndent = line.search(/\S/);
  270. var startRow = row;
  271. var startColumn = line.length;
  272. row = row + 1;
  273. var endRow = row;
  274. var maxRow = session.getLength();
  275. while (++row < maxRow) {
  276. line = session.getLine(row);
  277. var indent = line.search(/\S/);
  278. if (indent === -1)
  279. continue;
  280. if (startIndent > indent)
  281. break;
  282. var subRange = this.getFoldWidgetRange(session, "all", row);
  283. if (subRange) {
  284. if (subRange.start.row <= startRow) {
  285. break;
  286. } else if (subRange.isMultiLine()) {
  287. row = subRange.end.row;
  288. } else if (startIndent == indent) {
  289. break;
  290. }
  291. }
  292. endRow = row;
  293. }
  294. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  295. };
  296. this.getCommentRegionBlock = function(session, line, row) {
  297. var startColumn = line.search(/\s*$/);
  298. var maxRow = session.getLength();
  299. var startRow = row;
  300. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  301. var depth = 1;
  302. while (++row < maxRow) {
  303. line = session.getLine(row);
  304. var m = re.exec(line);
  305. if (!m) continue;
  306. if (m[1]) depth--;
  307. else depth++;
  308. if (!depth) break;
  309. }
  310. var endRow = row;
  311. if (endRow > startRow) {
  312. return new Range(startRow, startColumn, endRow, line.length);
  313. }
  314. };
  315. }).call(FoldMode.prototype);
  316. });
  317. ace.define("ace/mode/qml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/qml_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
  318. "use strict";
  319. var oop = require("../lib/oop");
  320. var TextMode = require("./text").Mode;
  321. var QmlHighlightRules = require("./qml_highlight_rules").QmlHighlightRules;
  322. var FoldMode = require("./folding/cstyle").FoldMode;
  323. var Mode = function() {
  324. this.HighlightRules = QmlHighlightRules;
  325. this.foldingRules = new FoldMode();
  326. this.$behaviour = this.$defaultBehaviour;
  327. };
  328. oop.inherits(Mode, TextMode);
  329. (function() {
  330. this.lineCommentStart = "//";
  331. this.blockComment = {start: "/*", end: "*/"};
  332. this.$quotes = { '"': '"', "'": "'" };
  333. this.$id = "ace/mode/qml";
  334. }).call(Mode.prototype);
  335. exports.Mode = Mode;
  336. }); (function() {
  337. ace.require(["ace/mode/qml"], function(m) {
  338. if (typeof module == "object" && typeof exports == "object" && module) {
  339. module.exports = m;
  340. }
  341. });
  342. })();