mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Merge branch 'ace-editor'
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
|
import _root_.util.JGitUtil.CommitInfo
|
||||||
import util.Directory._
|
import util.Directory._
|
||||||
import util.Implicits._
|
import util.Implicits._
|
||||||
import util.ControlUtil._
|
import _root_.util.ControlUtil._
|
||||||
import _root_.util._
|
import _root_.util._
|
||||||
import service._
|
import service._
|
||||||
import org.scalatra._
|
import org.scalatra._
|
||||||
@@ -12,17 +13,53 @@ import org.eclipse.jgit.lib._
|
|||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.eclipse.jgit.treewalk._
|
import org.eclipse.jgit.treewalk._
|
||||||
import java.util.zip.{ZipEntry, ZipOutputStream}
|
import java.util.zip.{ZipEntry, ZipOutputStream}
|
||||||
import scala.Some
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
import org.eclipse.jgit.dircache.DirCache
|
||||||
|
import org.eclipse.jgit.revwalk.{RevCommit, RevWalk}
|
||||||
|
|
||||||
class RepositoryViewerController extends RepositoryViewerControllerBase
|
class RepositoryViewerController extends RepositoryViewerControllerBase
|
||||||
with RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator
|
with RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository viewer.
|
* The repository viewer.
|
||||||
*/
|
*/
|
||||||
trait RepositoryViewerControllerBase extends ControllerBase {
|
trait RepositoryViewerControllerBase extends ControllerBase {
|
||||||
self: RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
self: RepositoryService with AccountService with ActivityService with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
||||||
|
|
||||||
|
case class EditorForm(
|
||||||
|
branch: String,
|
||||||
|
path: String,
|
||||||
|
content: String,
|
||||||
|
message: Option[String],
|
||||||
|
charset: String,
|
||||||
|
newFileName: String,
|
||||||
|
oldFileName: Option[String]
|
||||||
|
)
|
||||||
|
|
||||||
|
case class DeleteForm(
|
||||||
|
branch: String,
|
||||||
|
path: String,
|
||||||
|
message: Option[String],
|
||||||
|
fileName: String
|
||||||
|
)
|
||||||
|
|
||||||
|
val editorForm = mapping(
|
||||||
|
"branch" -> trim(label("Branch", text(required))),
|
||||||
|
"path" -> trim(label("Path", text())),
|
||||||
|
"content" -> trim(label("Content", text(required))),
|
||||||
|
"message" -> trim(label("Message", optional(text()))),
|
||||||
|
"charset" -> trim(label("Charset", text(required))),
|
||||||
|
"newFileName" -> trim(label("Filename", text(required))),
|
||||||
|
"oldFileName" -> trim(label("Old filename", optional(text())))
|
||||||
|
)(EditorForm.apply)
|
||||||
|
|
||||||
|
val deleteForm = mapping(
|
||||||
|
"branch" -> trim(label("Branch", text(required))),
|
||||||
|
"path" -> trim(label("Path", text())),
|
||||||
|
"message" -> trim(label("Message", optional(text()))),
|
||||||
|
"fileName" -> trim(label("Filename", text(required)))
|
||||||
|
)(DeleteForm.apply)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns converted HTML from Markdown for preview.
|
* Returns converted HTML from Markdown for preview.
|
||||||
*/
|
*/
|
||||||
@@ -71,6 +108,68 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
get("/:owner/:repository/new/*")(collaboratorsOnly { repository =>
|
||||||
|
val (branch, path) = splitPath(repository, multiParams("splat").head)
|
||||||
|
repo.html.editor(branch, repository, if(path.length == 0) Nil else path.split("/").toList,
|
||||||
|
None, JGitUtil.ContentInfo("text", None, Some("UTF-8")))
|
||||||
|
})
|
||||||
|
|
||||||
|
get("/:owner/:repository/edit/*")(collaboratorsOnly { repository =>
|
||||||
|
val (branch, path) = splitPath(repository, multiParams("splat").head)
|
||||||
|
|
||||||
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
|
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(branch))
|
||||||
|
|
||||||
|
getPathObjectId(git, path, revCommit).map { objectId =>
|
||||||
|
val paths = path.split("/")
|
||||||
|
repo.html.editor(branch, repository, paths.take(paths.size - 1).toList, Some(paths.last),
|
||||||
|
JGitUtil.getContentInfo(git, path, objectId))
|
||||||
|
} getOrElse NotFound
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
get("/:owner/:repository/remove/*")(collaboratorsOnly { repository =>
|
||||||
|
val (branch, path) = splitPath(repository, multiParams("splat").head)
|
||||||
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
|
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(branch))
|
||||||
|
|
||||||
|
getPathObjectId(git, path, revCommit).map { objectId =>
|
||||||
|
val paths = path.split("/")
|
||||||
|
repo.html.delete(branch, repository, paths.take(paths.size - 1).toList, paths.last,
|
||||||
|
JGitUtil.getContentInfo(git, path, objectId))
|
||||||
|
} getOrElse NotFound
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
post("/:owner/:repository/create", editorForm)(collaboratorsOnly { (form, repository) =>
|
||||||
|
commitFile(repository, form.branch, form.path, Some(form.newFileName), None, form.content, form.charset,
|
||||||
|
form.message.getOrElse(s"Create ${form.newFileName}"))
|
||||||
|
|
||||||
|
redirect(s"/${repository.owner}/${repository.name}/blob/${form.branch}/${
|
||||||
|
if(form.path.length == 0) form.newFileName else s"${form.path}/${form.newFileName}"
|
||||||
|
}")
|
||||||
|
})
|
||||||
|
|
||||||
|
post("/:owner/:repository/update", editorForm)(collaboratorsOnly { (form, repository) =>
|
||||||
|
commitFile(repository, form.branch, form.path, Some(form.newFileName), form.oldFileName, form.content, form.charset,
|
||||||
|
if(form.oldFileName.exists(_ == form.newFileName)){
|
||||||
|
form.message.getOrElse(s"Update ${form.newFileName}")
|
||||||
|
} else {
|
||||||
|
form.message.getOrElse(s"Rename ${form.oldFileName.get} to ${form.newFileName}")
|
||||||
|
})
|
||||||
|
|
||||||
|
redirect(s"/${repository.owner}/${repository.name}/blob/${form.branch}/${
|
||||||
|
if(form.path.length == 0) form.newFileName else s"${form.path}/${form.newFileName}"
|
||||||
|
}")
|
||||||
|
})
|
||||||
|
|
||||||
|
post("/:owner/:repository/remove", deleteForm)(collaboratorsOnly { (form, repository) =>
|
||||||
|
commitFile(repository, form.branch, form.path, None, Some(form.fileName), "", "",
|
||||||
|
form.message.getOrElse(s"Delete ${form.fileName}"))
|
||||||
|
|
||||||
|
redirect(s"/${repository.owner}/${repository.name}/tree/${form.branch}${if(form.path.length == 0) "" else form.path}")
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the file content of the specified branch or commit.
|
* Displays the file content of the specified branch or commit.
|
||||||
*/
|
*/
|
||||||
@@ -80,19 +179,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(id))
|
val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(id))
|
||||||
|
getPathObjectId(git, path, revCommit).map { objectId =>
|
||||||
@scala.annotation.tailrec
|
|
||||||
def getPathObjectId(path: String, walk: TreeWalk): Option[ObjectId] = walk.next match {
|
|
||||||
case true if(walk.getPathString == path) => Some(walk.getObjectId(0))
|
|
||||||
case true => getPathObjectId(path, walk)
|
|
||||||
case false => None
|
|
||||||
}
|
|
||||||
|
|
||||||
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
|
||||||
treeWalk.addTree(revCommit.getTree)
|
|
||||||
treeWalk.setRecursive(true)
|
|
||||||
getPathObjectId(path, treeWalk)
|
|
||||||
} map { objectId =>
|
|
||||||
if(raw){
|
if(raw){
|
||||||
// Download
|
// Download
|
||||||
defining(JGitUtil.getContentFromId(git, objectId, false).get){ bytes =>
|
defining(JGitUtil.getContentFromId(git, objectId, false).get){ bytes =>
|
||||||
@@ -100,25 +187,8 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
bytes
|
bytes
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Viewer
|
repo.html.blob(id, repository, path.split("/").toList, JGitUtil.getContentInfo(git, path, objectId),
|
||||||
val large = FileUtil.isLarge(git.getRepository.getObjectDatabase.open(objectId).getSize)
|
new JGitUtil.CommitInfo(revCommit), hasWritePermission(repository.owner, repository.name, context.loginAccount))
|
||||||
val viewer = if(FileUtil.isImage(path)) "image" else if(large) "large" else "other"
|
|
||||||
val bytes = if(viewer == "other") JGitUtil.getContentFromId(git, objectId, false) else None
|
|
||||||
|
|
||||||
val content = if(viewer == "other"){
|
|
||||||
if(bytes.isDefined && FileUtil.isText(bytes.get)){
|
|
||||||
// text
|
|
||||||
JGitUtil.ContentInfo("text", bytes.map(StringUtil.convertFromByteArray))
|
|
||||||
} else {
|
|
||||||
// binary
|
|
||||||
JGitUtil.ContentInfo("binary", None)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// image or large
|
|
||||||
JGitUtil.ContentInfo(viewer, None)
|
|
||||||
}
|
|
||||||
|
|
||||||
repo.html.blob(id, repository, path.split("/").toList, content, new JGitUtil.CommitInfo(revCommit))
|
|
||||||
}
|
}
|
||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
@@ -240,7 +310,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
repository.repository.originRepositoryName.getOrElse(repository.name)),
|
repository.repository.originRepositoryName.getOrElse(repository.name)),
|
||||||
repository)
|
repository)
|
||||||
})
|
})
|
||||||
|
|
||||||
private def splitPath(repository: service.RepositoryService.RepositoryInfo, path: String): (String, String) = {
|
private def splitPath(repository: service.RepositoryService.RepositoryInfo, path: String): (String, String) = {
|
||||||
val id = repository.branchList.collectFirst {
|
val id = repository.branchList.collectFirst {
|
||||||
case branch if(path == branch || path.startsWith(branch + "/")) => branch
|
case branch if(path == branch || path.startsWith(branch + "/")) => branch
|
||||||
@@ -256,7 +326,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides HTML of the file list.
|
* Provides HTML of the file list.
|
||||||
*
|
*
|
||||||
* @param repository the repository information
|
* @param repository the repository information
|
||||||
* @param revstr the branch name or commit id(optional)
|
* @param revstr the branch name or commit id(optional)
|
||||||
* @param path the directory path (optional)
|
* @param path the directory path (optional)
|
||||||
@@ -286,11 +356,77 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
repo.html.files(revision, repository,
|
repo.html.files(revision, repository,
|
||||||
if(path == ".") Nil else path.split("/").toList, // current path
|
if(path == ".") Nil else path.split("/").toList, // current path
|
||||||
new JGitUtil.CommitInfo(revCommit), // latest commit
|
new JGitUtil.CommitInfo(revCommit), // latest commit
|
||||||
files, readme)
|
files, readme, hasWritePermission(repository.owner, repository.name, context.loginAccount))
|
||||||
}
|
}
|
||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private def commitFile(repository: service.RepositoryService.RepositoryInfo,
|
||||||
|
branch: String, path: String, newFileName: Option[String], oldFileName: Option[String],
|
||||||
|
content: String, charset: String, message: String) = {
|
||||||
|
|
||||||
|
val newPath = newFileName.map { newFileName => if(path.length == 0) newFileName else s"${path}/${newFileName}" }
|
||||||
|
val oldPath = oldFileName.map { oldFileName => if(path.length == 0) oldFileName else s"${path}/${oldFileName}" }
|
||||||
|
|
||||||
|
LockUtil.lock(s"${repository.owner}/${repository.name}"){
|
||||||
|
using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git =>
|
||||||
|
val loginAccount = context.loginAccount.get
|
||||||
|
val builder = DirCache.newInCore.builder()
|
||||||
|
val inserter = git.getRepository.newObjectInserter()
|
||||||
|
val headName = s"refs/heads/${branch}"
|
||||||
|
val headTip = git.getRepository.resolve(s"refs/heads/${branch}")
|
||||||
|
|
||||||
|
JGitUtil.processTree(git, headTip){ (path, tree) =>
|
||||||
|
if(!newPath.exists(_ == path) && !oldPath.exists(_ == path)){
|
||||||
|
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newPath.foreach { newPath =>
|
||||||
|
builder.add(JGitUtil.createDirCacheEntry(newPath, FileMode.REGULAR_FILE,
|
||||||
|
inserter.insert(Constants.OBJ_BLOB, content.getBytes(charset))))
|
||||||
|
}
|
||||||
|
builder.finish()
|
||||||
|
|
||||||
|
val commitId = JGitUtil.createNewCommit(git, inserter, headTip, builder.getDirCache.writeTree(inserter),
|
||||||
|
loginAccount.fullName, loginAccount.mailAddress, message)
|
||||||
|
|
||||||
|
inserter.flush()
|
||||||
|
inserter.release()
|
||||||
|
|
||||||
|
// update refs
|
||||||
|
val refUpdate = git.getRepository.updateRef(headName)
|
||||||
|
refUpdate.setNewObjectId(commitId)
|
||||||
|
refUpdate.setForceUpdate(false)
|
||||||
|
refUpdate.setRefLogIdent(new PersonIdent(loginAccount.fullName, loginAccount.mailAddress))
|
||||||
|
//refUpdate.setRefLogMessage("merged", true)
|
||||||
|
refUpdate.update()
|
||||||
|
|
||||||
|
// record activity
|
||||||
|
recordPushActivity(repository.owner, repository.name, loginAccount.userName, branch,
|
||||||
|
List(new CommitInfo(JGitUtil.getRevCommitFromId(git, commitId))))
|
||||||
|
|
||||||
|
// TODO invoke hook
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private def getPathObjectId(git: Git, path: String, revCommit: RevCommit): Option[ObjectId] = {
|
||||||
|
@scala.annotation.tailrec
|
||||||
|
def _getPathObjectId(path: String, walk: TreeWalk): Option[ObjectId] = walk.next match {
|
||||||
|
case true if(walk.getPathString == path) => Some(walk.getObjectId(0))
|
||||||
|
case true => _getPathObjectId(path, walk)
|
||||||
|
case false => None
|
||||||
|
}
|
||||||
|
|
||||||
|
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
||||||
|
treeWalk.addTree(revCommit.getTree)
|
||||||
|
treeWalk.setRecursive(true)
|
||||||
|
_getPathObjectId(path, treeWalk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,17 +175,9 @@ trait WikiService {
|
|||||||
val inserter = git.getRepository.newObjectInserter()
|
val inserter = git.getRepository.newObjectInserter()
|
||||||
val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}")
|
val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}")
|
||||||
|
|
||||||
using(new RevWalk(git.getRepository)){ revWalk =>
|
JGitUtil.processTree(git, headId){ (path, tree) =>
|
||||||
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
if(revertInfo.find(x => x.filePath == path).isEmpty){
|
||||||
val index = treeWalk.addTree(revWalk.parseTree(headId))
|
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||||
treeWalk.setRecursive(true)
|
|
||||||
while(treeWalk.next){
|
|
||||||
val path = treeWalk.getPathString
|
|
||||||
val tree = treeWalk.getTree(index, classOf[CanonicalTreeParser])
|
|
||||||
if(revertInfo.find(x => x.filePath == path).isEmpty){
|
|
||||||
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,22 +218,14 @@ trait WikiService {
|
|||||||
var removed = false
|
var removed = false
|
||||||
|
|
||||||
if(headId != null){
|
if(headId != null){
|
||||||
using(new RevWalk(git.getRepository)){ revWalk =>
|
JGitUtil.processTree(git, headId){ (path, tree) =>
|
||||||
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
if(path == currentPageName + ".md" && currentPageName != newPageName){
|
||||||
val index = treeWalk.addTree(revWalk.parseTree(headId))
|
removed = true
|
||||||
treeWalk.setRecursive(true)
|
} else if(path != newPageName + ".md"){
|
||||||
while(treeWalk.next){
|
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||||
val path = treeWalk.getPathString
|
} else {
|
||||||
val tree = treeWalk.getTree(index, classOf[CanonicalTreeParser])
|
created = false
|
||||||
if(path == currentPageName + ".md" && currentPageName != newPageName){
|
updated = JGitUtil.getContentFromId(git, tree.getEntryObjectId, true).map(new String(_, "UTF-8") != content).getOrElse(false)
|
||||||
removed = true
|
|
||||||
} else if(path != newPageName + ".md"){
|
|
||||||
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
|
||||||
} else {
|
|
||||||
created = false
|
|
||||||
updated = JGitUtil.getContentFromId(git, tree.getEntryObjectId, true).map(new String(_, "UTF-8") != content).getOrElse(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,7 +246,7 @@ trait WikiService {
|
|||||||
message
|
message
|
||||||
})
|
})
|
||||||
|
|
||||||
Some(newHeadId)
|
Some(newHeadId.getName)
|
||||||
} else None
|
} else None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,26 +264,17 @@ trait WikiService {
|
|||||||
val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}")
|
val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}")
|
||||||
var removed = false
|
var removed = false
|
||||||
|
|
||||||
using(new RevWalk(git.getRepository)){ revWalk =>
|
JGitUtil.processTree(git, headId){ (path, tree) =>
|
||||||
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
if(path != pageName + ".md"){
|
||||||
val index = treeWalk.addTree(revWalk.parseTree(headId))
|
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||||
treeWalk.setRecursive(true)
|
} else {
|
||||||
while(treeWalk.next){
|
removed = true
|
||||||
val path = treeWalk.getPathString
|
|
||||||
val tree = treeWalk.getTree(index, classOf[CanonicalTreeParser])
|
|
||||||
if(path != pageName + ".md"){
|
|
||||||
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
|
||||||
} else {
|
|
||||||
removed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(removed){
|
|
||||||
builder.finish()
|
|
||||||
JGitUtil.createNewCommit(git, inserter, headId, builder.getDirCache.writeTree(inserter), committer, mailAddress, message)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(removed){
|
||||||
|
builder.finish()
|
||||||
|
JGitUtil.createNewCommit(git, inserter, headId, builder.getDirCache.writeTree(inserter), committer, mailAddress, message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,8 +92,9 @@ object JGitUtil {
|
|||||||
*
|
*
|
||||||
* @param viewType "image", "large" or "other"
|
* @param viewType "image", "large" or "other"
|
||||||
* @param content the string content
|
* @param content the string content
|
||||||
|
* @param charset the character encoding
|
||||||
*/
|
*/
|
||||||
case class ContentInfo(viewType: String, content: Option[String])
|
case class ContentInfo(viewType: String, content: Option[String], charset: Option[String])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tag data.
|
* The tag data.
|
||||||
@@ -480,7 +481,7 @@ object JGitUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def createNewCommit(git: Git, inserter: ObjectInserter, headId: AnyObjectId, treeId: AnyObjectId,
|
def createNewCommit(git: Git, inserter: ObjectInserter, headId: AnyObjectId, treeId: AnyObjectId,
|
||||||
fullName: String, mailAddress: String, message: String): String = {
|
fullName: String, mailAddress: String, message: String): ObjectId = {
|
||||||
val newCommit = new CommitBuilder()
|
val newCommit = new CommitBuilder()
|
||||||
newCommit.setCommitter(new PersonIdent(fullName, mailAddress))
|
newCommit.setCommitter(new PersonIdent(fullName, mailAddress))
|
||||||
newCommit.setAuthor(new PersonIdent(fullName, mailAddress))
|
newCommit.setAuthor(new PersonIdent(fullName, mailAddress))
|
||||||
@@ -498,7 +499,7 @@ object JGitUtil {
|
|||||||
refUpdate.setNewObjectId(newHeadId)
|
refUpdate.setNewObjectId(newHeadId)
|
||||||
refUpdate.update()
|
refUpdate.update()
|
||||||
|
|
||||||
newHeadId.getName
|
newHeadId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -549,6 +550,26 @@ object JGitUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getContentInfo(git: Git, path: String, objectId: ObjectId): ContentInfo = {
|
||||||
|
// Viewer
|
||||||
|
val large = FileUtil.isLarge(git.getRepository.getObjectDatabase.open(objectId).getSize)
|
||||||
|
val viewer = if(FileUtil.isImage(path)) "image" else if(large) "large" else "other"
|
||||||
|
val bytes = if(viewer == "other") JGitUtil.getContentFromId(git, objectId, false) else None
|
||||||
|
|
||||||
|
if(viewer == "other"){
|
||||||
|
if(bytes.isDefined && FileUtil.isText(bytes.get)){
|
||||||
|
// text
|
||||||
|
ContentInfo("text", Some(StringUtil.convertFromByteArray(bytes.get)), Some(StringUtil.detectEncoding(bytes.get)))
|
||||||
|
} else {
|
||||||
|
// binary
|
||||||
|
ContentInfo("binary", None, None)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// image or large
|
||||||
|
ContentInfo(viewer, None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object content of the given object id as byte array from the Git repository.
|
* Get object content of the given object id as byte array from the Git repository.
|
||||||
*
|
*
|
||||||
@@ -584,4 +605,17 @@ object JGitUtil {
|
|||||||
existIds.toSeq
|
existIds.toSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def processTree(git: Git, id: ObjectId)(f: (String, CanonicalTreeParser) => Unit) = {
|
||||||
|
using(new RevWalk(git.getRepository)){ revWalk =>
|
||||||
|
using(new TreeWalk(git.getRepository)){ treeWalk =>
|
||||||
|
val index = treeWalk.addTree(revWalk.parseTree(id))
|
||||||
|
treeWalk.setRecursive(true)
|
||||||
|
while(treeWalk.next){
|
||||||
|
f(treeWalk.getPathString, treeWalk.getTree(index, classOf[CanonicalTreeParser]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,6 +163,45 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
*/
|
*/
|
||||||
def isPast(date: Date): Boolean = System.currentTimeMillis > date.getTime
|
def isPast(date: Date): Boolean = System.currentTimeMillis > date.getTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns file type for AceEditor.
|
||||||
|
*/
|
||||||
|
def editorType(fileName: String): String = {
|
||||||
|
fileName.toLowerCase match {
|
||||||
|
case x if(x.endsWith(".bat")) => "batchfile"
|
||||||
|
case x if(x.endsWith(".java")) => "java"
|
||||||
|
case x if(x.endsWith(".scala")) => "scala"
|
||||||
|
case x if(x.endsWith(".js")) => "javascript"
|
||||||
|
case x if(x.endsWith(".css")) => "css"
|
||||||
|
case x if(x.endsWith(".md")) => "markdown"
|
||||||
|
case x if(x.endsWith(".html")) => "html"
|
||||||
|
case x if(x.endsWith(".xml")) => "xml"
|
||||||
|
case x if(x.endsWith(".c")) => "c_cpp"
|
||||||
|
case x if(x.endsWith(".cpp")) => "c_cpp"
|
||||||
|
case x if(x.endsWith(".coffee")) => "coffee"
|
||||||
|
case x if(x.endsWith(".ejs")) => "ejs"
|
||||||
|
case x if(x.endsWith(".hs")) => "haskell"
|
||||||
|
case x if(x.endsWith(".json")) => "json"
|
||||||
|
case x if(x.endsWith(".jsp")) => "jsp"
|
||||||
|
case x if(x.endsWith(".jsx")) => "jsx"
|
||||||
|
case x if(x.endsWith(".cl")) => "lisp"
|
||||||
|
case x if(x.endsWith(".clojure")) => "lisp"
|
||||||
|
case x if(x.endsWith(".lua")) => "lua"
|
||||||
|
case x if(x.endsWith(".php")) => "php"
|
||||||
|
case x if(x.endsWith(".py")) => "python"
|
||||||
|
case x if(x.endsWith(".rdoc")) => "rdoc"
|
||||||
|
case x if(x.endsWith(".rhtml")) => "rhtml"
|
||||||
|
case x if(x.endsWith(".ruby")) => "ruby"
|
||||||
|
case x if(x.endsWith(".sh")) => "sh"
|
||||||
|
case x if(x.endsWith(".sql")) => "sql"
|
||||||
|
case x if(x.endsWith(".tcl")) => "tcl"
|
||||||
|
case x if(x.endsWith(".vbs")) => "vbscript"
|
||||||
|
case x if(x.endsWith(".tcl")) => "tcl"
|
||||||
|
case x if(x.endsWith(".yml")) => "yaml"
|
||||||
|
case _ => "plain_text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit conversion to add mkHtml() to Seq[Html].
|
* Implicit conversion to add mkHtml() to Seq[Html].
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
content: util.JGitUtil.ContentInfo,
|
content: util.JGitUtil.ContentInfo,
|
||||||
latestCommit: util.JGitUtil.CommitInfo)(implicit context: app.Context)
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
|
hasWritePermission: Boolean)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
@@ -29,9 +30,15 @@
|
|||||||
<a href="@url(repository)/commit/@latestCommit.id" class="commit-message">@link(latestCommit.summary, repository)</a>
|
<a href="@url(repository)/commit/@latestCommit.id" class="commit-message">@link(latestCommit.summary, repository)</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<a class="btn btn-mini" href="?raw=true">Raw</a>
|
@if(hasWritePermission){
|
||||||
<a class="btn btn-mini" href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")">History</a>
|
<a class="btn" href="@url(repository)/edit/@encodeRefName(branch)/@pathList.mkString("/")">Edit</a>
|
||||||
</div>
|
}
|
||||||
|
<a class="btn" href="?raw=true">Raw</a>
|
||||||
|
<a class="btn" href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")">History</a>
|
||||||
|
@if(hasWritePermission){
|
||||||
|
<a class="btn btn-danger" href="@url(repository)/remove/@encodeRefName(branch)/@pathList.mkString("/")">Delete</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
110
src/main/twirl/repo/delete.scala.html
Normal file
110
src/main/twirl/repo/delete.scala.html
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
@(branch: String,
|
||||||
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
|
pathList: List[String],
|
||||||
|
fileName: String,
|
||||||
|
content: util.JGitUtil.ContentInfo)(implicit context: app.Context)
|
||||||
|
@import context._
|
||||||
|
@import view.helpers._
|
||||||
|
@html.main(s"Deleting ${path} at ${fileName} - ${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
|
@html.header("code", repository)
|
||||||
|
@tab(branch, repository, "files")
|
||||||
|
<form method="POST" action="@url(repository)/remove" validate="true">
|
||||||
|
<div class="head">
|
||||||
|
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
|
||||||
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
|
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
||||||
|
}
|
||||||
|
@fileName
|
||||||
|
<input type="hidden" name="fileName" id="fileName" value="@fileName"/>
|
||||||
|
<input type="hidden" name="branch" id="branch" value="@branch"/>
|
||||||
|
<input type="hidden" name="path" id="path" value="@pathList.mkString("/")"/>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<th style="font-weight: normal;" class="box-header">
|
||||||
|
@fileName
|
||||||
|
<div class="pull-right align-right">
|
||||||
|
<a href="@url(repository)/blob/@branch/@{(pathList ::: List(fileName)).mkString("/")}" class="btn btn-small">View</a>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="diffText"></div>
|
||||||
|
<textarea id="newText" style="display: none;"></textarea>
|
||||||
|
<textarea id="oldText" style="display: none;">@content.content</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="issue-avatar-image">@avatar(loginAccount.get.userName, 48)</div>
|
||||||
|
<div class="box issue-comment-box">
|
||||||
|
<div class="box-content">
|
||||||
|
<div>
|
||||||
|
<strong>Commit changes</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="message" style="width: 98%;"/>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<a href="@url(repository)/blob/@encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-danger">Cancel</a>
|
||||||
|
<input type="submit" id="commit" class="btn btn-success" value="Commit changes"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
<script type="text/javascript" src="@assets/jsdifflib/difflib.js"></script>
|
||||||
|
<script type="text/javascript" src="@assets/jsdifflib/diffview.js"></script>
|
||||||
|
<link href="@assets/jsdifflib/diffview.css" type="text/css" rel="stylesheet" />
|
||||||
|
<style type="text/css">
|
||||||
|
table.inlinediff {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.inlinediff thead {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.insert, td.equal, td.delete {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
function diffUsingJS(oldTextId, newTextId, outputId) {
|
||||||
|
// get the baseText and newText values from the two textboxes, and split them into lines
|
||||||
|
var oldText = document.getElementById(oldTextId).value;
|
||||||
|
if(oldText == ''){
|
||||||
|
var oldLines = [];
|
||||||
|
} else {
|
||||||
|
var oldLines = difflib.stringAsLines(oldText);
|
||||||
|
}
|
||||||
|
|
||||||
|
var newText = document.getElementById(newTextId).value
|
||||||
|
if(newText == ''){
|
||||||
|
var newLines = [];
|
||||||
|
} else {
|
||||||
|
var newLines = difflib.stringAsLines(newText);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a SequenceMatcher instance that diffs the two sets of lines
|
||||||
|
var sm = new difflib.SequenceMatcher(oldLines, newLines);
|
||||||
|
|
||||||
|
// get the opcodes from the SequenceMatcher instance
|
||||||
|
// opcodes is a list of 3-tuples describing what changes should be made to the base text
|
||||||
|
// in order to yield the new text
|
||||||
|
var opcodes = sm.get_opcodes();
|
||||||
|
var diffoutputdiv = document.getElementById(outputId);
|
||||||
|
while (diffoutputdiv.firstChild) diffoutputdiv.removeChild(diffoutputdiv.firstChild);
|
||||||
|
|
||||||
|
// build the diff view and add it to the current DOM
|
||||||
|
diffoutputdiv.appendChild(diffview.buildView({
|
||||||
|
baseTextLines: oldLines,
|
||||||
|
newTextLines: newLines,
|
||||||
|
opcodes: opcodes,
|
||||||
|
contextSize: 4,
|
||||||
|
viewType: 1
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
diffUsingJS('oldText', 'newText', 'diffText');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
107
src/main/twirl/repo/editor.scala.html
Normal file
107
src/main/twirl/repo/editor.scala.html
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@(branch: String,
|
||||||
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
|
pathList: List[String],
|
||||||
|
fileName: Option[String],
|
||||||
|
content: util.JGitUtil.ContentInfo)(implicit context: app.Context)
|
||||||
|
@import context._
|
||||||
|
@import view.helpers._
|
||||||
|
@html.main(if(fileName.isEmpty) "New File" else s"Editing ${path} at ${fileName} - ${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
|
@html.header("code", repository)
|
||||||
|
@tab(branch, repository, "files")
|
||||||
|
<form method="POST" action="@url(repository)/@if(fileName.isEmpty){create}else{update}" validate="true">
|
||||||
|
<span class="error" id="error-newFileName"></span>
|
||||||
|
<div class="head">
|
||||||
|
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
|
||||||
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
|
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
||||||
|
}
|
||||||
|
<input type="text" name="newFileName" id="newFileName" placeholder="Name your file..." value="@fileName"/>
|
||||||
|
<input type="hidden" name="oldFileName" id="oldFileName" value="@fileName"/>
|
||||||
|
<input type="hidden" name="branch" id="branch" value="@branch"/>
|
||||||
|
<input type="hidden" name="path" id="path" value="@pathList.mkString("/")"/>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<div class="pull-right">
|
||||||
|
<select id="wrap" class="input-medium" style="margin-bottom: 0px;">
|
||||||
|
<optgroup label="Line Wrap Mode">
|
||||||
|
<option value="false">No wrap</option>
|
||||||
|
<option value="true">Soft wrap</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="editor" style="width: 100%; height: 600px;"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="issue-avatar-image">@avatar(loginAccount.get.userName, 48)</div>
|
||||||
|
<div class="box issue-comment-box">
|
||||||
|
<div class="box-content">
|
||||||
|
<div>
|
||||||
|
<strong>Commit changes</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="message" style="width: 98%;"/>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
@if(fileName.isEmpty){
|
||||||
|
<a href="@url(repository)/tree/@encodeRefName(branch)/@{pathList.mkString("/")}" class="btn btn-danger">Cancel</a>
|
||||||
|
} else {
|
||||||
|
<a href="@url(repository)/blob/@encodeRefName(branch)/@{(pathList ++ Seq(fileName.get)).mkString("/")}" class="btn btn-danger">Cancel</a>
|
||||||
|
}
|
||||||
|
<input type="submit" id="commit" class="btn btn-success" value="Commit changes" disabled="true"/>
|
||||||
|
<input type="hidden" id="charset" name="charset" value="@content.charset"/>
|
||||||
|
<input type="hidden" id="content" name="content" value=""/>
|
||||||
|
<input type="hidden" id="initial" value="@content.content"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
<script src="@assets/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#editor').text($('#initial').val());
|
||||||
|
var editor = ace.edit("editor");
|
||||||
|
editor.setTheme("ace/theme/monokai");
|
||||||
|
//editor.getSession().setUseWrapMode(false);
|
||||||
|
|
||||||
|
@if(fileName.isDefined){
|
||||||
|
editor.getSession().setMode("ace/mode/@editorType(fileName.get)");
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.on('change', function(){
|
||||||
|
updateCommitButtonStatus();
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateCommitButtonStatus(){
|
||||||
|
if(editor.getValue() == $('#initial').val() && $('#newFileName').val() == $('#oldFileName').val()){
|
||||||
|
$('#commit').attr('disabled', true);
|
||||||
|
} else {
|
||||||
|
$('#commit').attr('disabled', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#wrap').change(function(){
|
||||||
|
console.log($('#wrap option:selected').val());
|
||||||
|
if($('#wrap option:selected').val() == 'true'){
|
||||||
|
editor.getSession().setUseWrapMode(true);
|
||||||
|
} else {
|
||||||
|
editor.getSession().setUseWrapMode(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#newFileName').watch(function(){
|
||||||
|
updateCommitButtonStatus();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#commit').click(function(){
|
||||||
|
$('#content').val(editor.getValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
latestCommit: util.JGitUtil.CommitInfo,
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
files: List[util.JGitUtil.FileInfo],
|
files: List[util.JGitUtil.FileInfo],
|
||||||
readme: Option[(List[String], String)])(implicit context: app.Context)
|
readme: Option[(List[String], String)],
|
||||||
|
hasWritePermission: Boolean)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
@@ -19,6 +20,9 @@
|
|||||||
@pathList.zipWithIndex.map { case (section, i) =>
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
||||||
}
|
}
|
||||||
|
@if(hasWritePermission){
|
||||||
|
<a href="@url(repository)/new/@encodeRefName(branch)/@pathList.mkString("/")"><img src="@assets/common/images/newfile.png"/></a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<table class="table table-file-list" style="border: 1px solid silver;">
|
<table class="table table-file-list" style="border: 1px solid silver;">
|
||||||
|
|||||||
17629
src/main/webapp/assets/ace/ace.js
Normal file
17629
src/main/webapp/assets/ace/ace.js
Normal file
File diff suppressed because it is too large
Load Diff
360
src/main/webapp/assets/ace/ext-beautify.js
Normal file
360
src/main/webapp/assets/ace/ext-beautify.js
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/beautify', ['require', 'exports', 'module' , 'ace/token_iterator', 'ace/ext/beautify/php_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var TokenIterator = require("ace/token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
var phpTransform = require("./beautify/php_rules").transform;
|
||||||
|
|
||||||
|
exports.beautify = function(session) {
|
||||||
|
var iterator = new TokenIterator(session, 0, 0);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
|
||||||
|
var context = session.$modeId.split("/").pop();
|
||||||
|
|
||||||
|
var code = phpTransform(iterator, context);
|
||||||
|
session.doc.setValue(code);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.commands = [{
|
||||||
|
name: "beautify",
|
||||||
|
exec: function(editor) {
|
||||||
|
exports.beautify(editor.session);
|
||||||
|
},
|
||||||
|
bindKey: "Ctrl-Shift-B"
|
||||||
|
}]
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/beautify/php_rules', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var TokenIterator = require("ace/token_iterator").TokenIterator;
|
||||||
|
exports.newLines = [{
|
||||||
|
type: 'support.php_tag',
|
||||||
|
value: '<?php'
|
||||||
|
}, {
|
||||||
|
type: 'support.php_tag',
|
||||||
|
value: '<?'
|
||||||
|
}, {
|
||||||
|
type: 'support.php_tag',
|
||||||
|
value: '?>'
|
||||||
|
}, {
|
||||||
|
type: 'paren.lparen',
|
||||||
|
value: '{',
|
||||||
|
indent: true
|
||||||
|
}, {
|
||||||
|
type: 'paren.rparen',
|
||||||
|
breakBefore: true,
|
||||||
|
value: '}',
|
||||||
|
indent: false
|
||||||
|
}, {
|
||||||
|
type: 'paren.rparen',
|
||||||
|
breakBefore: true,
|
||||||
|
value: '})',
|
||||||
|
indent: false,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'comment'
|
||||||
|
}, {
|
||||||
|
type: 'text',
|
||||||
|
value: ';'
|
||||||
|
}, {
|
||||||
|
type: 'text',
|
||||||
|
value: ':',
|
||||||
|
context: 'php'
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'case',
|
||||||
|
indent: true,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'default',
|
||||||
|
indent: true,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'break',
|
||||||
|
indent: false,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'punctuation.doctype.end',
|
||||||
|
value: '>'
|
||||||
|
}, {
|
||||||
|
type: 'meta.tag.punctuation.end',
|
||||||
|
value: '>'
|
||||||
|
}, {
|
||||||
|
type: 'meta.tag.punctuation.begin',
|
||||||
|
value: '<',
|
||||||
|
blockTag: true,
|
||||||
|
indent: true,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'meta.tag.punctuation.begin',
|
||||||
|
value: '</',
|
||||||
|
indent: false,
|
||||||
|
breakBefore: true,
|
||||||
|
dontBreak: true
|
||||||
|
}, {
|
||||||
|
type: 'punctuation.operator',
|
||||||
|
value: ';'
|
||||||
|
}];
|
||||||
|
|
||||||
|
exports.spaces = [{
|
||||||
|
type: 'xml-pe',
|
||||||
|
prepend: true
|
||||||
|
},{
|
||||||
|
type: 'entity.other.attribute-name',
|
||||||
|
prepend: true
|
||||||
|
}, {
|
||||||
|
type: 'storage.type',
|
||||||
|
value: 'var',
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'storage.type',
|
||||||
|
value: 'function',
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword.operator',
|
||||||
|
value: '='
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'as',
|
||||||
|
prepend: true,
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'function',
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'support.function',
|
||||||
|
next: /[^\(]/,
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'or',
|
||||||
|
append: true,
|
||||||
|
prepend: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'and',
|
||||||
|
append: true,
|
||||||
|
prepend: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword',
|
||||||
|
value: 'case',
|
||||||
|
append: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword.operator',
|
||||||
|
value: '||',
|
||||||
|
append: true,
|
||||||
|
prepend: true
|
||||||
|
}, {
|
||||||
|
type: 'keyword.operator',
|
||||||
|
value: '&&',
|
||||||
|
append: true,
|
||||||
|
prepend: true
|
||||||
|
}];
|
||||||
|
exports.singleTags = ['!doctype','area','base','br','hr','input','img','link','meta'];
|
||||||
|
|
||||||
|
exports.transform = function(iterator, maxPos, context) {
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
|
||||||
|
var newLines = exports.newLines;
|
||||||
|
var spaces = exports.spaces;
|
||||||
|
var singleTags = exports.singleTags;
|
||||||
|
|
||||||
|
var code = '';
|
||||||
|
|
||||||
|
var indentation = 0;
|
||||||
|
var dontBreak = false;
|
||||||
|
var tag;
|
||||||
|
var lastTag;
|
||||||
|
var lastToken = {};
|
||||||
|
var nextTag;
|
||||||
|
var nextToken = {};
|
||||||
|
var breakAdded = false;
|
||||||
|
var value = '';
|
||||||
|
|
||||||
|
while (token!==null) {
|
||||||
|
console.log(token);
|
||||||
|
|
||||||
|
if( !token ){
|
||||||
|
token = iterator.stepForward();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( token.type == 'support.php_tag' && token.value != '?>' ){
|
||||||
|
context = 'php';
|
||||||
|
}
|
||||||
|
else if( token.type == 'support.php_tag' && token.value == '?>' ){
|
||||||
|
context = 'html';
|
||||||
|
}
|
||||||
|
else if( token.type == 'meta.tag.name.style' && context != 'css' ){
|
||||||
|
context = 'css';
|
||||||
|
}
|
||||||
|
else if( token.type == 'meta.tag.name.style' && context == 'css' ){
|
||||||
|
context = 'html';
|
||||||
|
}
|
||||||
|
else if( token.type == 'meta.tag.name.script' && context != 'js' ){
|
||||||
|
context = 'js';
|
||||||
|
}
|
||||||
|
else if( token.type == 'meta.tag.name.script' && context == 'js' ){
|
||||||
|
context = 'html';
|
||||||
|
}
|
||||||
|
|
||||||
|
nextToken = iterator.stepForward();
|
||||||
|
if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) {
|
||||||
|
nextTag = nextToken.value;
|
||||||
|
}
|
||||||
|
if ( lastToken.type == 'support.php_tag' && lastToken.value == '<?=') {
|
||||||
|
dontBreak = true;
|
||||||
|
}
|
||||||
|
if (token.type == 'meta.tag.name') {
|
||||||
|
token.value = token.value.toLowerCase();
|
||||||
|
}
|
||||||
|
if (token.type == 'text') {
|
||||||
|
token.value = token.value.trim();
|
||||||
|
}
|
||||||
|
if (!token.value) {
|
||||||
|
token = nextToken;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
value = token.value;
|
||||||
|
for (var i in spaces) {
|
||||||
|
if (
|
||||||
|
token.type == spaces[i].type &&
|
||||||
|
(!spaces[i].value || token.value == spaces[i].value) &&
|
||||||
|
(
|
||||||
|
nextToken &&
|
||||||
|
(!spaces[i].next || spaces[i].next.test(nextToken.value))
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (spaces[i].prepend) {
|
||||||
|
value = ' ' + token.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spaces[i].append) {
|
||||||
|
value += ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (token.type.indexOf('meta.tag.name') == 0) {
|
||||||
|
tag = token.value;
|
||||||
|
}
|
||||||
|
breakAdded = false;
|
||||||
|
for (i in newLines) {
|
||||||
|
if (
|
||||||
|
token.type == newLines[i].type &&
|
||||||
|
(
|
||||||
|
!newLines[i].value ||
|
||||||
|
token.value == newLines[i].value
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
!newLines[i].blockTag ||
|
||||||
|
singleTags.indexOf(nextTag) === -1
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
!newLines[i].context ||
|
||||||
|
newLines[i].context === context
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (newLines[i].indent === false) {
|
||||||
|
indentation--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
newLines[i].breakBefore &&
|
||||||
|
( !newLines[i].prev || newLines[i].prev.test(lastToken.value) )
|
||||||
|
) {
|
||||||
|
code += "\n";
|
||||||
|
breakAdded = true;
|
||||||
|
for (i = 0; i < indentation; i++) {
|
||||||
|
code += "\t";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dontBreak===false) {
|
||||||
|
for (i in newLines) {
|
||||||
|
if (
|
||||||
|
lastToken.type == newLines[i].type &&
|
||||||
|
(
|
||||||
|
!newLines[i].value || lastToken.value == newLines[i].value
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
!newLines[i].blockTag ||
|
||||||
|
singleTags.indexOf(tag) === -1
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
!newLines[i].context ||
|
||||||
|
newLines[i].context === context
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (newLines[i].indent === true) {
|
||||||
|
indentation++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newLines[i].dontBreak && !breakAdded) {
|
||||||
|
code += "\n";
|
||||||
|
for (i = 0; i < indentation; i++) {
|
||||||
|
code += "\t";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
code += value;
|
||||||
|
if ( lastToken.type == 'support.php_tag' && lastToken.value == '?>' ) {
|
||||||
|
dontBreak = false;
|
||||||
|
}
|
||||||
|
lastTag = tag;
|
||||||
|
|
||||||
|
lastToken = token;
|
||||||
|
|
||||||
|
token = nextToken;
|
||||||
|
|
||||||
|
if (token===null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
537
src/main/webapp/assets/ace/ext-chromevox.js
Normal file
537
src/main/webapp/assets/ace/ext-chromevox.js
Normal file
@@ -0,0 +1,537 @@
|
|||||||
|
ace.define('ace/ext/chromevox', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) {
|
||||||
|
var cvoxAce = {};
|
||||||
|
cvoxAce.SpeechProperty;
|
||||||
|
cvoxAce.Cursor;
|
||||||
|
cvoxAce.Token;
|
||||||
|
cvoxAce.Annotation;
|
||||||
|
var CONSTANT_PROP = {
|
||||||
|
'rate': 0.8,
|
||||||
|
'pitch': 0.4,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var DEFAULT_PROP = {
|
||||||
|
'rate': 1,
|
||||||
|
'pitch': 0.5,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var ENTITY_PROP = {
|
||||||
|
'rate': 0.8,
|
||||||
|
'pitch': 0.8,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var KEYWORD_PROP = {
|
||||||
|
'rate': 0.8,
|
||||||
|
'pitch': 0.3,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var STORAGE_PROP = {
|
||||||
|
'rate': 0.8,
|
||||||
|
'pitch': 0.7,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var VARIABLE_PROP = {
|
||||||
|
'rate': 0.8,
|
||||||
|
'pitch': 0.8,
|
||||||
|
'volume': 0.9
|
||||||
|
};
|
||||||
|
var DELETED_PROP = {
|
||||||
|
'punctuationEcho': 'none',
|
||||||
|
'relativePitch': -0.6
|
||||||
|
};
|
||||||
|
var ERROR_EARCON = 'ALERT_NONMODAL';
|
||||||
|
var MODE_SWITCH_EARCON = 'ALERT_MODAL';
|
||||||
|
var NO_MATCH_EARCON = 'INVALID_KEYPRESS';
|
||||||
|
var INSERT_MODE_STATE = 'insertMode';
|
||||||
|
var COMMAND_MODE_STATE = 'start';
|
||||||
|
|
||||||
|
var REPLACE_LIST = [
|
||||||
|
{
|
||||||
|
substr: ';',
|
||||||
|
newSubstr: ' semicolon '
|
||||||
|
},
|
||||||
|
{
|
||||||
|
substr: ':',
|
||||||
|
newSubstr: ' colon '
|
||||||
|
}
|
||||||
|
];
|
||||||
|
var Command = {
|
||||||
|
SPEAK_ANNOT: 'annots',
|
||||||
|
SPEAK_ALL_ANNOTS: 'all_annots',
|
||||||
|
TOGGLE_LOCATION: 'toggle_location',
|
||||||
|
SPEAK_MODE: 'mode',
|
||||||
|
SPEAK_ROW_COL: 'row_col',
|
||||||
|
TOGGLE_DISPLACEMENT: 'toggle_displacement',
|
||||||
|
FOCUS_TEXT: 'focus_text'
|
||||||
|
};
|
||||||
|
var KEY_PREFIX = 'CONTROL + SHIFT ';
|
||||||
|
cvoxAce.editor = null;
|
||||||
|
var lastCursor = null;
|
||||||
|
var annotTable = {};
|
||||||
|
var shouldSpeakRowLocation = false;
|
||||||
|
var shouldSpeakDisplacement = false;
|
||||||
|
var changed = false;
|
||||||
|
var vimState = null;
|
||||||
|
var keyCodeToShortcutMap = {};
|
||||||
|
var cmdToShortcutMap = {};
|
||||||
|
var getKeyShortcutString = function(keyCode) {
|
||||||
|
return KEY_PREFIX + String.fromCharCode(keyCode);
|
||||||
|
};
|
||||||
|
var isVimMode = function() {
|
||||||
|
var keyboardHandler = cvoxAce.editor.keyBinding.getKeyboardHandler();
|
||||||
|
return keyboardHandler.$id === 'ace/keyboard/vim';
|
||||||
|
};
|
||||||
|
var getCurrentToken = function(cursor) {
|
||||||
|
return cvoxAce.editor.getSession().getTokenAt(cursor.row, cursor.column + 1);
|
||||||
|
};
|
||||||
|
var getCurrentLine = function(cursor) {
|
||||||
|
return cvoxAce.editor.getSession().getLine(cursor.row);
|
||||||
|
};
|
||||||
|
var onRowChange = function(currCursor) {
|
||||||
|
if (annotTable[currCursor.row]) {
|
||||||
|
cvox.Api.playEarcon(ERROR_EARCON);
|
||||||
|
}
|
||||||
|
if (shouldSpeakRowLocation) {
|
||||||
|
cvox.Api.stop();
|
||||||
|
speakChar(currCursor);
|
||||||
|
speakTokenQueue(getCurrentToken(currCursor));
|
||||||
|
speakLine(currCursor.row, 1);
|
||||||
|
} else {
|
||||||
|
speakLine(currCursor.row, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var isWord = function(cursor) {
|
||||||
|
var line = getCurrentLine(cursor);
|
||||||
|
var lineSuffix = line.substr(cursor.column - 1);
|
||||||
|
if (cursor.column === 0) {
|
||||||
|
lineSuffix = ' ' + line;
|
||||||
|
}
|
||||||
|
var firstWordRegExp = /^\W(\w+)/;
|
||||||
|
var words = firstWordRegExp.exec(lineSuffix);
|
||||||
|
return words !== null;
|
||||||
|
};
|
||||||
|
var rules = {
|
||||||
|
'constant': {
|
||||||
|
prop: CONSTANT_PROP
|
||||||
|
},
|
||||||
|
'entity': {
|
||||||
|
prop: ENTITY_PROP
|
||||||
|
},
|
||||||
|
'keyword': {
|
||||||
|
prop: KEYWORD_PROP
|
||||||
|
},
|
||||||
|
'storage': {
|
||||||
|
prop: STORAGE_PROP
|
||||||
|
},
|
||||||
|
'variable': {
|
||||||
|
prop: VARIABLE_PROP
|
||||||
|
},
|
||||||
|
'meta': {
|
||||||
|
prop: DEFAULT_PROP,
|
||||||
|
replace: [
|
||||||
|
{
|
||||||
|
substr: '</',
|
||||||
|
newSubstr: ' closing tag '
|
||||||
|
},
|
||||||
|
{
|
||||||
|
substr: '/>',
|
||||||
|
newSubstr: ' close tag '
|
||||||
|
},
|
||||||
|
{
|
||||||
|
substr: '<',
|
||||||
|
newSubstr: ' tag start '
|
||||||
|
},
|
||||||
|
{
|
||||||
|
substr: '>',
|
||||||
|
newSubstr: ' tag end '
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var DEFAULT_RULE = {
|
||||||
|
prop: DEFAULT_RULE
|
||||||
|
};
|
||||||
|
var expand = function(value, replaceRules) {
|
||||||
|
var newValue = value;
|
||||||
|
for (var i = 0; i < replaceRules.length; i++) {
|
||||||
|
var replaceRule = replaceRules[i];
|
||||||
|
var regexp = new RegExp(replaceRule.substr, 'g');
|
||||||
|
newValue = newValue.replace(regexp, replaceRule.newSubstr);
|
||||||
|
}
|
||||||
|
return newValue;
|
||||||
|
};
|
||||||
|
var mergeTokens = function(tokens, start, end) {
|
||||||
|
var newToken = {};
|
||||||
|
newToken.value = '';
|
||||||
|
newToken.type = tokens[start].type;
|
||||||
|
for (var j = start; j < end; j++) {
|
||||||
|
newToken.value += tokens[j].value;
|
||||||
|
}
|
||||||
|
return newToken;
|
||||||
|
};
|
||||||
|
var mergeLikeTokens = function(tokens) {
|
||||||
|
if (tokens.length <= 1) {
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
var newTokens = [];
|
||||||
|
var lastLikeIndex = 0;
|
||||||
|
for (var i = 1; i < tokens.length; i++) {
|
||||||
|
var lastLikeToken = tokens[lastLikeIndex];
|
||||||
|
var currToken = tokens[i];
|
||||||
|
if (getTokenRule(lastLikeToken) !== getTokenRule(currToken)) {
|
||||||
|
newTokens.push(mergeTokens(tokens, lastLikeIndex, i));
|
||||||
|
lastLikeIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newTokens.push(mergeTokens(tokens, lastLikeIndex, tokens.length));
|
||||||
|
return newTokens;
|
||||||
|
};
|
||||||
|
var isRowWhiteSpace = function(row) {
|
||||||
|
var line = cvoxAce.editor.getSession().getLine(row);
|
||||||
|
var whiteSpaceRegexp = /^\s*$/;
|
||||||
|
return whiteSpaceRegexp.exec(line) !== null;
|
||||||
|
};
|
||||||
|
var speakLine = function(row, queue) {
|
||||||
|
var tokens = cvoxAce.editor.getSession().getTokens(row);
|
||||||
|
if (tokens.length === 0 || isRowWhiteSpace(row)) {
|
||||||
|
cvox.Api.playEarcon('EDITABLE_TEXT');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tokens = mergeLikeTokens(tokens);
|
||||||
|
var firstToken = tokens[0];
|
||||||
|
tokens = tokens.filter(function(token) {
|
||||||
|
return token !== firstToken;
|
||||||
|
});
|
||||||
|
speakToken_(firstToken, queue);
|
||||||
|
tokens.forEach(speakTokenQueue);
|
||||||
|
};
|
||||||
|
var speakTokenFlush = function(token) {
|
||||||
|
speakToken_(token, 0);
|
||||||
|
};
|
||||||
|
var speakTokenQueue = function(token) {
|
||||||
|
speakToken_(token, 1);
|
||||||
|
};
|
||||||
|
var getTokenRule = function(token) {
|
||||||
|
if (!token || !token.type) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var split = token.type.split('.');
|
||||||
|
if (split.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var type = split[0];
|
||||||
|
var rule = rules[type];
|
||||||
|
if (!rule) {
|
||||||
|
return DEFAULT_RULE;
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
};
|
||||||
|
var speakToken_ = function(token, queue) {
|
||||||
|
var rule = getTokenRule(token);
|
||||||
|
var value = expand(token.value, REPLACE_LIST);
|
||||||
|
if (rule.replace) {
|
||||||
|
value = expand(value, rule.replace);
|
||||||
|
}
|
||||||
|
cvox.Api.speak(value, queue, rule.prop);
|
||||||
|
};
|
||||||
|
var speakChar = function(cursor) {
|
||||||
|
var line = getCurrentLine(cursor);
|
||||||
|
cvox.Api.speak(line[cursor.column], 1);
|
||||||
|
};
|
||||||
|
var speakDisplacement = function(lastCursor, currCursor) {
|
||||||
|
var line = getCurrentLine(currCursor);
|
||||||
|
var displace = line.substring(lastCursor.column, currCursor.column);
|
||||||
|
displace = displace.replace(/ /g, ' space ');
|
||||||
|
cvox.Api.speak(displace);
|
||||||
|
};
|
||||||
|
var speakCharOrWordOrLine = function(lastCursor, currCursor) {
|
||||||
|
if (Math.abs(lastCursor.column - currCursor.column) !== 1) {
|
||||||
|
var currLineLength = getCurrentLine(currCursor).length;
|
||||||
|
if (currCursor.column === 0 || currCursor.column === currLineLength) {
|
||||||
|
speakLine(currCursor.row, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isWord(currCursor)) {
|
||||||
|
cvox.Api.stop();
|
||||||
|
speakTokenQueue(getCurrentToken(currCursor));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
speakChar(currCursor);
|
||||||
|
};
|
||||||
|
var onColumnChange = function(lastCursor, currCursor) {
|
||||||
|
if (!cvoxAce.editor.selection.isEmpty()) {
|
||||||
|
speakDisplacement(lastCursor, currCursor);
|
||||||
|
cvox.Api.speak('selected', 1);
|
||||||
|
}
|
||||||
|
else if (shouldSpeakDisplacement) {
|
||||||
|
speakDisplacement(lastCursor, currCursor);
|
||||||
|
} else {
|
||||||
|
speakCharOrWordOrLine(lastCursor, currCursor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var onCursorChange = function(evt) {
|
||||||
|
if (changed) {
|
||||||
|
changed = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var currCursor = cvoxAce.editor.selection.getCursor();
|
||||||
|
if (currCursor.row !== lastCursor.row) {
|
||||||
|
onRowChange(currCursor);
|
||||||
|
} else {
|
||||||
|
onColumnChange(lastCursor, currCursor);
|
||||||
|
}
|
||||||
|
lastCursor = currCursor;
|
||||||
|
};
|
||||||
|
var onSelectionChange = function(evt) {
|
||||||
|
if (cvoxAce.editor.selection.isEmpty()) {
|
||||||
|
cvox.Api.speak('unselected');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var onChange = function(evt) {
|
||||||
|
var data = evt.data;
|
||||||
|
switch (data.action) {
|
||||||
|
case 'removeText':
|
||||||
|
cvox.Api.speak(data.text, 0, DELETED_PROP);
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
case 'insertText':
|
||||||
|
cvox.Api.speak(data.text, 0);
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var isNewAnnotation = function(annot) {
|
||||||
|
var row = annot.row;
|
||||||
|
var col = annot.column;
|
||||||
|
return !annotTable[row] || !annotTable[row][col];
|
||||||
|
};
|
||||||
|
var populateAnnotations = function(annotations) {
|
||||||
|
annotTable = {};
|
||||||
|
for (var i = 0; i < annotations.length; i++) {
|
||||||
|
var annotation = annotations[i];
|
||||||
|
var row = annotation.row;
|
||||||
|
var col = annotation.column;
|
||||||
|
if (!annotTable[row]) {
|
||||||
|
annotTable[row] = {};
|
||||||
|
}
|
||||||
|
annotTable[row][col] = annotation;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var onAnnotationChange = function(evt) {
|
||||||
|
var annotations = cvoxAce.editor.getSession().getAnnotations();
|
||||||
|
var newAnnotations = annotations.filter(isNewAnnotation);
|
||||||
|
if (newAnnotations.length > 0) {
|
||||||
|
cvox.Api.playEarcon(ERROR_EARCON);
|
||||||
|
}
|
||||||
|
populateAnnotations(annotations);
|
||||||
|
};
|
||||||
|
var speakAnnot = function(annot) {
|
||||||
|
var annotText = annot.type + ' ' + annot.text + ' on ' +
|
||||||
|
rowColToString(annot.row, annot.column);
|
||||||
|
annotText = annotText.replace(';', 'semicolon');
|
||||||
|
cvox.Api.speak(annotText, 1);
|
||||||
|
};
|
||||||
|
var speakAnnotsByRow = function(row) {
|
||||||
|
var annots = annotTable[row];
|
||||||
|
for (var col in annots) {
|
||||||
|
speakAnnot(annots[col]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var rowColToString = function(row, col) {
|
||||||
|
return 'row ' + (row + 1) + ' column ' + (col + 1);
|
||||||
|
};
|
||||||
|
var speakCurrRowAndCol = function() {
|
||||||
|
cvox.Api.speak(rowColToString(lastCursor.row, lastCursor.column));
|
||||||
|
};
|
||||||
|
var speakAllAnnots = function() {
|
||||||
|
for (var row in annotTable) {
|
||||||
|
speakAnnotsByRow(row);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var speakMode = function() {
|
||||||
|
if (!isVimMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (cvoxAce.editor.keyBinding.$data.state) {
|
||||||
|
case INSERT_MODE_STATE:
|
||||||
|
cvox.Api.speak('Insert mode');
|
||||||
|
break;
|
||||||
|
case COMMAND_MODE_STATE:
|
||||||
|
cvox.Api.speak('Command mode');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var toggleSpeakRowLocation = function() {
|
||||||
|
shouldSpeakRowLocation = !shouldSpeakRowLocation;
|
||||||
|
if (shouldSpeakRowLocation) {
|
||||||
|
cvox.Api.speak('Speak location on row change enabled.');
|
||||||
|
} else {
|
||||||
|
cvox.Api.speak('Speak location on row change disabled.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var toggleSpeakDisplacement = function() {
|
||||||
|
shouldSpeakDisplacement = !shouldSpeakDisplacement;
|
||||||
|
if (shouldSpeakDisplacement) {
|
||||||
|
cvox.Api.speak('Speak displacement on column changes.');
|
||||||
|
} else {
|
||||||
|
cvox.Api.speak('Speak current character or word on column changes.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var onKeyDown = function(evt) {
|
||||||
|
if (evt.ctrlKey && evt.shiftKey) {
|
||||||
|
var shortcut = keyCodeToShortcutMap[evt.keyCode];
|
||||||
|
if (shortcut) {
|
||||||
|
shortcut.func();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var onChangeStatus = function(evt, editor) {
|
||||||
|
if (!isVimMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var state = editor.keyBinding.$data.state;
|
||||||
|
if (state === vimState) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (state) {
|
||||||
|
case INSERT_MODE_STATE:
|
||||||
|
cvox.Api.playEarcon(MODE_SWITCH_EARCON);
|
||||||
|
cvox.Api.setKeyEcho(true);
|
||||||
|
break;
|
||||||
|
case COMMAND_MODE_STATE:
|
||||||
|
cvox.Api.playEarcon(MODE_SWITCH_EARCON);
|
||||||
|
cvox.Api.setKeyEcho(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vimState = state;
|
||||||
|
};
|
||||||
|
var contextMenuHandler = function(evt) {
|
||||||
|
var cmd = evt.detail['customCommand'];
|
||||||
|
var shortcut = cmdToShortcutMap[cmd];
|
||||||
|
if (shortcut) {
|
||||||
|
shortcut.func();
|
||||||
|
cvoxAce.editor.focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var initContextMenu = function() {
|
||||||
|
var ACTIONS = SHORTCUTS.map(function(shortcut) {
|
||||||
|
return {
|
||||||
|
desc: shortcut.desc + getKeyShortcutString(shortcut.keyCode),
|
||||||
|
cmd: shortcut.cmd
|
||||||
|
};
|
||||||
|
});
|
||||||
|
var body = document.querySelector('body');
|
||||||
|
body.setAttribute('contextMenuActions', JSON.stringify(ACTIONS));
|
||||||
|
body.addEventListener('ATCustomEvent', contextMenuHandler, true);
|
||||||
|
};
|
||||||
|
var onFindSearchbox = function(evt) {
|
||||||
|
if (evt.match) {
|
||||||
|
speakLine(lastCursor.row, 0);
|
||||||
|
} else {
|
||||||
|
cvox.Api.playEarcon(NO_MATCH_EARCON);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var focus = function() {
|
||||||
|
cvoxAce.editor.focus();
|
||||||
|
};
|
||||||
|
var SHORTCUTS = [
|
||||||
|
{
|
||||||
|
keyCode: 49,
|
||||||
|
func: function() {
|
||||||
|
speakAnnotsByRow(lastCursor.row);
|
||||||
|
},
|
||||||
|
cmd: Command.SPEAK_ANNOT,
|
||||||
|
desc: 'Speak annotations on line'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 50,
|
||||||
|
func: speakAllAnnots,
|
||||||
|
cmd: Command.SPEAK_ALL_ANNOTS,
|
||||||
|
desc: 'Speak all annotations'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 51,
|
||||||
|
func: speakMode,
|
||||||
|
cmd: Command.SPEAK_MODE,
|
||||||
|
desc: 'Speak Vim mode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 52,
|
||||||
|
func: toggleSpeakRowLocation,
|
||||||
|
cmd: Command.TOGGLE_LOCATION,
|
||||||
|
desc: 'Toggle speak row location'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 53,
|
||||||
|
func: speakCurrRowAndCol,
|
||||||
|
cmd: Command.SPEAK_ROW_COL,
|
||||||
|
desc: 'Speak row and column'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 54,
|
||||||
|
func: toggleSpeakDisplacement,
|
||||||
|
cmd: Command.TOGGLE_DISPLACEMENT,
|
||||||
|
desc: 'Toggle speak displacement'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keyCode: 55,
|
||||||
|
func: focus,
|
||||||
|
cmd: Command.FOCUS_TEXT,
|
||||||
|
desc: 'Focus text'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
var onFocus = function() {
|
||||||
|
cvoxAce.editor = editor;
|
||||||
|
editor.getSession().selection.on('changeCursor', onCursorChange);
|
||||||
|
editor.getSession().selection.on('changeSelection', onSelectionChange);
|
||||||
|
editor.getSession().on('change', onChange);
|
||||||
|
editor.getSession().on('changeAnnotation', onAnnotationChange);
|
||||||
|
editor.on('changeStatus', onChangeStatus);
|
||||||
|
editor.on('findSearchBox', onFindSearchbox);
|
||||||
|
editor.container.addEventListener('keydown', onKeyDown);
|
||||||
|
|
||||||
|
lastCursor = editor.selection.getCursor();
|
||||||
|
};
|
||||||
|
var init = function(editor) {
|
||||||
|
onFocus();
|
||||||
|
SHORTCUTS.forEach(function(shortcut) {
|
||||||
|
keyCodeToShortcutMap[shortcut.keyCode] = shortcut;
|
||||||
|
cmdToShortcutMap[shortcut.cmd] = shortcut;
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.on('focus', onFocus);
|
||||||
|
if (isVimMode()) {
|
||||||
|
cvox.Api.setKeyEcho(false);
|
||||||
|
}
|
||||||
|
initContextMenu();
|
||||||
|
};
|
||||||
|
function cvoxApiExists() {
|
||||||
|
return (typeof(cvox) !== 'undefined') && cvox && cvox.Api;
|
||||||
|
}
|
||||||
|
var tries = 0;
|
||||||
|
var MAX_TRIES = 15;
|
||||||
|
function watchForCvoxLoad(editor) {
|
||||||
|
if (cvoxApiExists()) {
|
||||||
|
init(editor);
|
||||||
|
} else {
|
||||||
|
tries++;
|
||||||
|
if (tries >= MAX_TRIES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.setTimeout(watchForCvoxLoad, 500, editor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var Editor = require('../editor').Editor;
|
||||||
|
require('../config').defineOptions(Editor.prototype, 'editor', {
|
||||||
|
enableChromevoxEnhancements: {
|
||||||
|
set: function(val) {
|
||||||
|
if (val) {
|
||||||
|
watchForCvoxLoad(this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: true // turn it on by default or check for window.cvox
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
301
src/main/webapp/assets/ace/ext-elastic_tabstops_lite.js
Normal file
301
src/main/webapp/assets/ace/ext-elastic_tabstops_lite.js
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/elastic_tabstops_lite', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var ElasticTabstopsLite = function(editor) {
|
||||||
|
this.$editor = editor;
|
||||||
|
var self = this;
|
||||||
|
var changedRows = [];
|
||||||
|
var recordChanges = false;
|
||||||
|
this.onAfterExec = function() {
|
||||||
|
recordChanges = false;
|
||||||
|
self.processRows(changedRows);
|
||||||
|
changedRows = [];
|
||||||
|
};
|
||||||
|
this.onExec = function() {
|
||||||
|
recordChanges = true;
|
||||||
|
};
|
||||||
|
this.onChange = function(e) {
|
||||||
|
var range = e.data.range
|
||||||
|
if (recordChanges) {
|
||||||
|
if (changedRows.indexOf(range.start.row) == -1)
|
||||||
|
changedRows.push(range.start.row);
|
||||||
|
if (range.end.row != range.start.row)
|
||||||
|
changedRows.push(range.end.row);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.processRows = function(rows) {
|
||||||
|
this.$inChange = true;
|
||||||
|
var checkedRows = [];
|
||||||
|
|
||||||
|
for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
|
||||||
|
var row = rows[r];
|
||||||
|
|
||||||
|
if (checkedRows.indexOf(row) > -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var cellWidthObj = this.$findCellWidthsForBlock(row);
|
||||||
|
var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
|
||||||
|
var rowIndex = cellWidthObj.firstRow;
|
||||||
|
|
||||||
|
for (var w = 0, l = cellWidths.length; w < l; w++) {
|
||||||
|
var widths = cellWidths[w];
|
||||||
|
checkedRows.push(rowIndex);
|
||||||
|
this.$adjustRow(rowIndex, widths);
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$inChange = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$findCellWidthsForBlock = function(row) {
|
||||||
|
var cellWidths = [], widths;
|
||||||
|
var rowIter = row;
|
||||||
|
while (rowIter >= 0) {
|
||||||
|
widths = this.$cellWidthsForRow(rowIter);
|
||||||
|
if (widths.length == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
cellWidths.unshift(widths);
|
||||||
|
rowIter--;
|
||||||
|
}
|
||||||
|
var firstRow = rowIter + 1;
|
||||||
|
rowIter = row;
|
||||||
|
var numRows = this.$editor.session.getLength();
|
||||||
|
|
||||||
|
while (rowIter < numRows - 1) {
|
||||||
|
rowIter++;
|
||||||
|
|
||||||
|
widths = this.$cellWidthsForRow(rowIter);
|
||||||
|
if (widths.length == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
cellWidths.push(widths);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { cellWidths: cellWidths, firstRow: firstRow };
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$cellWidthsForRow = function(row) {
|
||||||
|
var selectionColumns = this.$selectionColumnsForRow(row);
|
||||||
|
|
||||||
|
var tabs = [-1].concat(this.$tabsForRow(row));
|
||||||
|
var widths = tabs.map(function(el) { return 0; } ).slice(1);
|
||||||
|
var line = this.$editor.session.getLine(row);
|
||||||
|
|
||||||
|
for (var i = 0, len = tabs.length - 1; i < len; i++) {
|
||||||
|
var leftEdge = tabs[i]+1;
|
||||||
|
var rightEdge = tabs[i+1];
|
||||||
|
|
||||||
|
var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
|
||||||
|
var cell = line.substring(leftEdge, rightEdge);
|
||||||
|
widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge);
|
||||||
|
}
|
||||||
|
|
||||||
|
return widths;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$selectionColumnsForRow = function(row) {
|
||||||
|
var selections = [], cursor = this.$editor.getCursorPosition();
|
||||||
|
if (this.$editor.session.getSelection().isEmpty()) {
|
||||||
|
if (row == cursor.row)
|
||||||
|
selections.push(cursor.column);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$setBlockCellWidthsToMax = function(cellWidths) {
|
||||||
|
var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
|
||||||
|
var columnInfo = this.$izip_longest(cellWidths);
|
||||||
|
|
||||||
|
for (var c = 0, l = columnInfo.length; c < l; c++) {
|
||||||
|
var column = columnInfo[c];
|
||||||
|
if (!column.push) {
|
||||||
|
console.error(column);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
column.push(NaN);
|
||||||
|
|
||||||
|
for (var r = 0, s = column.length; r < s; r++) {
|
||||||
|
var width = column[r];
|
||||||
|
if (startingNewBlock) {
|
||||||
|
blockStartRow = r;
|
||||||
|
maxWidth = 0;
|
||||||
|
startingNewBlock = false;
|
||||||
|
}
|
||||||
|
if (isNaN(width)) {
|
||||||
|
blockEndRow = r;
|
||||||
|
|
||||||
|
for (var j = blockStartRow; j < blockEndRow; j++) {
|
||||||
|
cellWidths[j][c] = maxWidth;
|
||||||
|
}
|
||||||
|
startingNewBlock = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxWidth = Math.max(maxWidth, width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cellWidths;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) {
|
||||||
|
var rightmost = 0;
|
||||||
|
|
||||||
|
if (selectionColumns.length) {
|
||||||
|
var lengths = [];
|
||||||
|
for (var s = 0, length = selectionColumns.length; s < length; s++) {
|
||||||
|
if (selectionColumns[s] <= cellRightEdge)
|
||||||
|
lengths.push(s);
|
||||||
|
else
|
||||||
|
lengths.push(0);
|
||||||
|
}
|
||||||
|
rightmost = Math.max.apply(Math, lengths);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rightmost;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$tabsForRow = function(row) {
|
||||||
|
var rowTabs = [], line = this.$editor.session.getLine(row),
|
||||||
|
re = /\t/g, match;
|
||||||
|
|
||||||
|
while ((match = re.exec(line)) != null) {
|
||||||
|
rowTabs.push(match.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rowTabs;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$adjustRow = function(row, widths) {
|
||||||
|
var rowTabs = this.$tabsForRow(row);
|
||||||
|
|
||||||
|
if (rowTabs.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var bias = 0, location = -1;
|
||||||
|
var expandedSet = this.$izip(widths, rowTabs);
|
||||||
|
|
||||||
|
for (var i = 0, l = expandedSet.length; i < l; i++) {
|
||||||
|
var w = expandedSet[i][0], it = expandedSet[i][1];
|
||||||
|
location += 1 + w;
|
||||||
|
it += bias;
|
||||||
|
var difference = location - it;
|
||||||
|
|
||||||
|
if (difference == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var partialLine = this.$editor.session.getLine(row).substr(0, it );
|
||||||
|
var strippedPartialLine = partialLine.replace(/\s*$/g, "");
|
||||||
|
var ispaces = partialLine.length - strippedPartialLine.length;
|
||||||
|
|
||||||
|
if (difference > 0) {
|
||||||
|
this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t");
|
||||||
|
this.$editor.session.getDocument().removeInLine(row, it, it + 1);
|
||||||
|
|
||||||
|
bias += difference;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difference < 0 && ispaces >= -difference) {
|
||||||
|
this.$editor.session.getDocument().removeInLine(row, it + difference, it);
|
||||||
|
bias += difference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.$izip_longest = function(iterables) {
|
||||||
|
if (!iterables[0])
|
||||||
|
return [];
|
||||||
|
var longest = iterables[0].length;
|
||||||
|
var iterablesLength = iterables.length;
|
||||||
|
|
||||||
|
for (var i = 1; i < iterablesLength; i++) {
|
||||||
|
var iLength = iterables[i].length;
|
||||||
|
if (iLength > longest)
|
||||||
|
longest = iLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expandedSet = [];
|
||||||
|
|
||||||
|
for (var l = 0; l < longest; l++) {
|
||||||
|
var set = [];
|
||||||
|
for (var i = 0; i < iterablesLength; i++) {
|
||||||
|
if (iterables[i][l] === "")
|
||||||
|
set.push(NaN);
|
||||||
|
else
|
||||||
|
set.push(iterables[i][l]);
|
||||||
|
}
|
||||||
|
|
||||||
|
expandedSet.push(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return expandedSet;
|
||||||
|
};
|
||||||
|
this.$izip = function(widths, tabs) {
|
||||||
|
var size = widths.length >= tabs.length ? tabs.length : widths.length;
|
||||||
|
|
||||||
|
var expandedSet = [];
|
||||||
|
for (var i = 0; i < size; i++) {
|
||||||
|
var set = [ widths[i], tabs[i] ];
|
||||||
|
expandedSet.push(set);
|
||||||
|
}
|
||||||
|
return expandedSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(ElasticTabstopsLite.prototype);
|
||||||
|
|
||||||
|
exports.ElasticTabstopsLite = ElasticTabstopsLite;
|
||||||
|
|
||||||
|
var Editor = require("../editor").Editor;
|
||||||
|
require("../config").defineOptions(Editor.prototype, "editor", {
|
||||||
|
useElasticTabstops: {
|
||||||
|
set: function(val) {
|
||||||
|
if (val) {
|
||||||
|
if (!this.elasticTabstops)
|
||||||
|
this.elasticTabstops = new ElasticTabstopsLite(this);
|
||||||
|
this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
|
||||||
|
this.commands.on("exec", this.elasticTabstops.onExec);
|
||||||
|
this.on("change", this.elasticTabstops.onChange);
|
||||||
|
} else if (this.elasticTabstops) {
|
||||||
|
this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
|
||||||
|
this.commands.removeListener("exec", this.elasticTabstops.onExec);
|
||||||
|
this.removeListener("change", this.elasticTabstops.onChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
1113
src/main/webapp/assets/ace/ext-emmet.js
Normal file
1113
src/main/webapp/assets/ace/ext-emmet.js
Normal file
File diff suppressed because it is too large
Load Diff
0
src/main/webapp/assets/ace/ext-error_marker.js
Normal file
0
src/main/webapp/assets/ace/ext-error_marker.js
Normal file
207
src/main/webapp/assets/ace/ext-keybinding_menu.js
Normal file
207
src/main/webapp/assets/ace/ext-keybinding_menu.js
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Contributed to Ajax.org under the BSD license.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/keybinding_menu', ['require', 'exports', 'module' , 'ace/editor', 'ace/ext/menu_tools/overlay_page', 'ace/ext/menu_tools/get_editor_keyboard_shortcuts'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var Editor = require("ace/editor").Editor;
|
||||||
|
function showKeyboardShortcuts (editor) {
|
||||||
|
if(!document.getElementById('kbshortcutmenu')) {
|
||||||
|
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
|
||||||
|
var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
|
||||||
|
var kb = getEditorKeybordShortcuts(editor);
|
||||||
|
var el = document.createElement('div');
|
||||||
|
var commands = kb.reduce(function(previous, current) {
|
||||||
|
return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'
|
||||||
|
+ current.command + '</span> : '
|
||||||
|
+ '<span class="ace_optionsMenuKey">' + current.key + '</span></div>';
|
||||||
|
}, '');
|
||||||
|
|
||||||
|
el.id = 'kbshortcutmenu';
|
||||||
|
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
|
||||||
|
overlayPage(editor, el, '0', '0', '0', null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
module.exports.init = function(editor) {
|
||||||
|
Editor.prototype.showKeyboardShortcuts = function() {
|
||||||
|
showKeyboardShortcuts(this);
|
||||||
|
};
|
||||||
|
editor.commands.addCommands([{
|
||||||
|
name: "showKeyboardShortcuts",
|
||||||
|
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
|
||||||
|
exec: function(editor, line) {
|
||||||
|
editor.showKeyboardShortcuts();
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var dom = require("../../lib/dom");
|
||||||
|
var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
|
||||||
|
background-color: #F7F7F7;\
|
||||||
|
color: black;\
|
||||||
|
box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
|
||||||
|
padding: 1em 0.5em 2em 1em;\
|
||||||
|
overflow: auto;\
|
||||||
|
position: absolute;\
|
||||||
|
margin: 0;\
|
||||||
|
bottom: 0;\
|
||||||
|
right: 0;\
|
||||||
|
top: 0;\
|
||||||
|
z-index: 9991;\
|
||||||
|
cursor: default;\
|
||||||
|
}\
|
||||||
|
.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
|
||||||
|
box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
|
||||||
|
background-color: rgba(255, 255, 255, 0.6);\
|
||||||
|
color: black;\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuEntry:hover {\
|
||||||
|
background-color: rgba(100, 100, 100, 0.1);\
|
||||||
|
-webkit-transition: all 0.5s;\
|
||||||
|
transition: all 0.3s\
|
||||||
|
}\
|
||||||
|
.ace_closeButton {\
|
||||||
|
background: rgba(245, 146, 146, 0.5);\
|
||||||
|
border: 1px solid #F48A8A;\
|
||||||
|
border-radius: 50%;\
|
||||||
|
padding: 7px;\
|
||||||
|
position: absolute;\
|
||||||
|
right: -8px;\
|
||||||
|
top: -8px;\
|
||||||
|
z-index: 1000;\
|
||||||
|
}\
|
||||||
|
.ace_closeButton{\
|
||||||
|
background: rgba(245, 146, 146, 0.9);\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuKey {\
|
||||||
|
color: darkslateblue;\
|
||||||
|
font-weight: bold;\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuCommand {\
|
||||||
|
color: darkcyan;\
|
||||||
|
font-weight: normal;\
|
||||||
|
}";
|
||||||
|
dom.importCssString(cssText);
|
||||||
|
module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
|
||||||
|
top = top ? 'top: ' + top + ';' : '';
|
||||||
|
bottom = bottom ? 'bottom: ' + bottom + ';' : '';
|
||||||
|
right = right ? 'right: ' + right + ';' : '';
|
||||||
|
left = left ? 'left: ' + left + ';' : '';
|
||||||
|
|
||||||
|
var closer = document.createElement('div');
|
||||||
|
var contentContainer = document.createElement('div');
|
||||||
|
|
||||||
|
function documentEscListener(e) {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
closer.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closer.style.cssText = 'margin: 0; padding: 0; ' +
|
||||||
|
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
||||||
|
'z-index: 9990; ' +
|
||||||
|
'background-color: rgba(0, 0, 0, 0.3);';
|
||||||
|
closer.addEventListener('click', function() {
|
||||||
|
document.removeEventListener('keydown', documentEscListener);
|
||||||
|
closer.parentNode.removeChild(closer);
|
||||||
|
editor.focus();
|
||||||
|
closer = null;
|
||||||
|
});
|
||||||
|
document.addEventListener('keydown', documentEscListener);
|
||||||
|
|
||||||
|
contentContainer.style.cssText = top + right + bottom + left;
|
||||||
|
contentContainer.addEventListener('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
var wrapper = dom.createElement("div");
|
||||||
|
wrapper.style.position = "relative";
|
||||||
|
|
||||||
|
var closeButton = dom.createElement("div");
|
||||||
|
closeButton.className = "ace_closeButton";
|
||||||
|
closeButton.addEventListener('click', function() {
|
||||||
|
closer.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapper.appendChild(closeButton);
|
||||||
|
contentContainer.appendChild(wrapper);
|
||||||
|
|
||||||
|
contentContainer.appendChild(contentElement);
|
||||||
|
closer.appendChild(contentContainer);
|
||||||
|
document.body.appendChild(closer);
|
||||||
|
editor.blur();
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/get_editor_keyboard_shortcuts', ['require', 'exports', 'module' , 'ace/lib/keys'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var keys = require("../../lib/keys");
|
||||||
|
module.exports.getEditorKeybordShortcuts = function(editor) {
|
||||||
|
var KEY_MODS = keys.KEY_MODS;
|
||||||
|
var keybindings = [];
|
||||||
|
var commandMap = {};
|
||||||
|
editor.keyBinding.$handlers.forEach(function(handler) {
|
||||||
|
var ckb = handler.commandKeyBinding;
|
||||||
|
for (var i in ckb) {
|
||||||
|
var modifier = parseInt(i);
|
||||||
|
if (modifier == -1) {
|
||||||
|
modifier = "";
|
||||||
|
} else if(isNaN(modifier)) {
|
||||||
|
modifier = i;
|
||||||
|
} else {
|
||||||
|
modifier = "" +
|
||||||
|
(modifier & KEY_MODS.command ? "Cmd-" : "") +
|
||||||
|
(modifier & KEY_MODS.ctrl ? "Ctrl-" : "") +
|
||||||
|
(modifier & KEY_MODS.alt ? "Alt-" : "") +
|
||||||
|
(modifier & KEY_MODS.shift ? "Shift-" : "");
|
||||||
|
}
|
||||||
|
for (var key in ckb[i]) {
|
||||||
|
var command = ckb[i][key]
|
||||||
|
if (typeof command != "string")
|
||||||
|
command = command.name
|
||||||
|
if (commandMap[command]) {
|
||||||
|
commandMap[command].key += "|" + modifier + key;
|
||||||
|
} else {
|
||||||
|
commandMap[command] = {key: modifier+key, command: command};
|
||||||
|
keybindings.push(commandMap[command]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return keybindings;
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
1756
src/main/webapp/assets/ace/ext-language_tools.js
Normal file
1756
src/main/webapp/assets/ace/ext-language_tools.js
Normal file
File diff suppressed because it is too large
Load Diff
171
src/main/webapp/assets/ace/ext-modelist.js
Normal file
171
src/main/webapp/assets/ace/ext-modelist.js
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
ace.define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var modes = [];
|
||||||
|
function getModeForPath(path) {
|
||||||
|
var mode = modesByName.text;
|
||||||
|
var fileName = path.split(/[\/\\]/).pop();
|
||||||
|
for (var i = 0; i < modes.length; i++) {
|
||||||
|
if (modes[i].supportsFile(fileName)) {
|
||||||
|
mode = modes[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Mode = function(name, caption, extensions) {
|
||||||
|
this.name = name;
|
||||||
|
this.caption = caption;
|
||||||
|
this.mode = "ace/mode/" + name;
|
||||||
|
this.extensions = extensions;
|
||||||
|
if (/\^/.test(extensions)) {
|
||||||
|
var re = extensions.replace(/\|(\^)?/g, function(a, b){
|
||||||
|
return "$|" + (b ? "^" : "^.*\\.");
|
||||||
|
}) + "$";
|
||||||
|
} else {
|
||||||
|
var re = "^.*\\.(" + extensions + ")$";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.extRe = new RegExp(re, "gi");
|
||||||
|
};
|
||||||
|
|
||||||
|
Mode.prototype.supportsFile = function(filename) {
|
||||||
|
return filename.match(this.extRe);
|
||||||
|
};
|
||||||
|
var supportedModes = {
|
||||||
|
ABAP: ["abap"],
|
||||||
|
ActionScript:["as"],
|
||||||
|
ADA: ["ada|adb"],
|
||||||
|
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
|
||||||
|
AsciiDoc: ["asciidoc"],
|
||||||
|
Assembly_x86:["asm"],
|
||||||
|
AutoHotKey: ["ahk"],
|
||||||
|
BatchFile: ["bat|cmd"],
|
||||||
|
C9Search: ["c9search_results"],
|
||||||
|
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
||||||
|
Cirru: ["cirru|cr"],
|
||||||
|
Clojure: ["clj"],
|
||||||
|
Cobol: ["CBL|COB"],
|
||||||
|
coffee: ["coffee|cf|cson|^Cakefile"],
|
||||||
|
ColdFusion: ["cfm"],
|
||||||
|
CSharp: ["cs"],
|
||||||
|
CSS: ["css"],
|
||||||
|
Curly: ["curly"],
|
||||||
|
D: ["d|di"],
|
||||||
|
Dart: ["dart"],
|
||||||
|
Diff: ["diff|patch"],
|
||||||
|
Dot: ["dot"],
|
||||||
|
Erlang: ["erl|hrl"],
|
||||||
|
EJS: ["ejs"],
|
||||||
|
Forth: ["frt|fs|ldr"],
|
||||||
|
FTL: ["ftl"],
|
||||||
|
Gherkin: ["feature"],
|
||||||
|
Glsl: ["glsl|frag|vert"],
|
||||||
|
golang: ["go"],
|
||||||
|
Groovy: ["groovy"],
|
||||||
|
HAML: ["haml"],
|
||||||
|
Handlebars: ["hbs|handlebars|tpl|mustache"],
|
||||||
|
Haskell: ["hs"],
|
||||||
|
haXe: ["hx"],
|
||||||
|
HTML: ["html|htm|xhtml"],
|
||||||
|
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||||
|
INI: ["ini|conf|cfg|prefs"],
|
||||||
|
Jack: ["jack"],
|
||||||
|
Jade: ["jade"],
|
||||||
|
Java: ["java"],
|
||||||
|
JavaScript: ["js|jsm"],
|
||||||
|
JSON: ["json"],
|
||||||
|
JSONiq: ["jq"],
|
||||||
|
JSP: ["jsp"],
|
||||||
|
JSX: ["jsx"],
|
||||||
|
Julia: ["jl"],
|
||||||
|
LaTeX: ["tex|latex|ltx|bib"],
|
||||||
|
LESS: ["less"],
|
||||||
|
Liquid: ["liquid"],
|
||||||
|
Lisp: ["lisp"],
|
||||||
|
LiveScript: ["ls"],
|
||||||
|
LogiQL: ["logic|lql"],
|
||||||
|
LSL: ["lsl"],
|
||||||
|
Lua: ["lua"],
|
||||||
|
LuaPage: ["lp"],
|
||||||
|
Lucene: ["lucene"],
|
||||||
|
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
||||||
|
MATLAB: ["matlab"],
|
||||||
|
Markdown: ["md|markdown"],
|
||||||
|
MEL: ["mel"],
|
||||||
|
MySQL: ["mysql"],
|
||||||
|
MUSHCode: ["mc|mush"],
|
||||||
|
Nix: ["nix"],
|
||||||
|
ObjectiveC: ["m|mm"],
|
||||||
|
OCaml: ["ml|mli"],
|
||||||
|
Pascal: ["pas|p"],
|
||||||
|
Perl: ["pl|pm"],
|
||||||
|
pgSQL: ["pgsql"],
|
||||||
|
PHP: ["php|phtml"],
|
||||||
|
Powershell: ["ps1"],
|
||||||
|
Prolog: ["plg|prolog"],
|
||||||
|
Properties: ["properties"],
|
||||||
|
Protobuf: ["proto"],
|
||||||
|
Python: ["py"],
|
||||||
|
R: ["r"],
|
||||||
|
RDoc: ["Rd"],
|
||||||
|
RHTML: ["Rhtml"],
|
||||||
|
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
|
||||||
|
Rust: ["rs"],
|
||||||
|
SASS: ["sass"],
|
||||||
|
SCAD: ["scad"],
|
||||||
|
Scala: ["scala"],
|
||||||
|
Smarty: ["smarty|tpl"],
|
||||||
|
Scheme: ["scm|rkt"],
|
||||||
|
SCSS: ["scss"],
|
||||||
|
SH: ["sh|bash|^.bashrc"],
|
||||||
|
SJS: ["sjs"],
|
||||||
|
Space: ["space"],
|
||||||
|
snippets: ["snippets"],
|
||||||
|
Soy_Template:["soy"],
|
||||||
|
SQL: ["sql"],
|
||||||
|
Stylus: ["styl|stylus"],
|
||||||
|
SVG: ["svg"],
|
||||||
|
Tcl: ["tcl"],
|
||||||
|
Tex: ["tex"],
|
||||||
|
Text: ["txt"],
|
||||||
|
Textile: ["textile"],
|
||||||
|
Toml: ["toml"],
|
||||||
|
Twig: ["twig"],
|
||||||
|
Typescript: ["ts|typescript|str"],
|
||||||
|
VBScript: ["vbs"],
|
||||||
|
Velocity: ["vm"],
|
||||||
|
Verilog: ["v|vh|sv|svh"],
|
||||||
|
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||||
|
XQuery: ["xq"],
|
||||||
|
YAML: ["yaml|yml"]
|
||||||
|
};
|
||||||
|
|
||||||
|
var nameOverrides = {
|
||||||
|
ObjectiveC: "Objective-C",
|
||||||
|
CSharp: "C#",
|
||||||
|
golang: "Go",
|
||||||
|
C_Cpp: "C/C++",
|
||||||
|
coffee: "CoffeeScript",
|
||||||
|
HTML_Ruby: "HTML (Ruby)",
|
||||||
|
FTL: "FreeMarker"
|
||||||
|
};
|
||||||
|
var modesByName = {};
|
||||||
|
for (var name in supportedModes) {
|
||||||
|
var data = supportedModes[name];
|
||||||
|
var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
|
||||||
|
var filename = name.toLowerCase();
|
||||||
|
var mode = new Mode(filename, displayName, data[0]);
|
||||||
|
modesByName[filename] = mode;
|
||||||
|
modes.push(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getModeForPath: getModeForPath,
|
||||||
|
modes: modes,
|
||||||
|
modesByName: modesByName
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
506
src/main/webapp/assets/ace/ext-old_ie.js
Normal file
506
src/main/webapp/assets/ace/ext-old_ie.js
Normal file
@@ -0,0 +1,506 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/old_ie', ['require', 'exports', 'module' , 'ace/lib/useragent', 'ace/tokenizer', 'ace/ext/searchbox', 'ace/mode/text'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var MAX_TOKEN_COUNT = 1000;
|
||||||
|
var useragent = require("../lib/useragent");
|
||||||
|
var TokenizerModule = require("../tokenizer");
|
||||||
|
|
||||||
|
function patch(obj, name, regexp, replacement) {
|
||||||
|
eval("obj['" + name + "']=" + obj[name].toString().replace(
|
||||||
|
regexp, replacement
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat")
|
||||||
|
useragent.isOldIE = true;
|
||||||
|
|
||||||
|
if (typeof document != "undefined" && !document.documentElement.querySelector) {
|
||||||
|
useragent.isOldIE = true;
|
||||||
|
var qs = function(el, selector) {
|
||||||
|
if (selector.charAt(0) == ".") {
|
||||||
|
var classNeme = selector.slice(1);
|
||||||
|
} else {
|
||||||
|
var m = selector.match(/(\w+)=(\w+)/);
|
||||||
|
var attr = m && m[1];
|
||||||
|
var attrVal = m && m[2];
|
||||||
|
}
|
||||||
|
for (var i = 0; i < el.all.length; i++) {
|
||||||
|
var ch = el.all[i];
|
||||||
|
if (classNeme) {
|
||||||
|
if (ch.className.indexOf(classNeme) != -1)
|
||||||
|
return ch;
|
||||||
|
} else if (attr) {
|
||||||
|
if (ch.getAttribute(attr) == attrVal)
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var sb = require("./searchbox").SearchBox.prototype;
|
||||||
|
patch(
|
||||||
|
sb, "$initElements",
|
||||||
|
/([^\s=]*).querySelector\((".*?")\)/g,
|
||||||
|
"qs($1, $2)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var compliantExecNpcg = /()??/.exec("")[1] === undefined;
|
||||||
|
if (compliantExecNpcg)
|
||||||
|
return;
|
||||||
|
var proto = TokenizerModule.Tokenizer.prototype;
|
||||||
|
TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer;
|
||||||
|
proto.getLineTokens_orig = proto.getLineTokens;
|
||||||
|
|
||||||
|
patch(
|
||||||
|
TokenizerModule, "Tokenizer",
|
||||||
|
"ruleRegExps.push(adjustedregex);\n",
|
||||||
|
function(m) {
|
||||||
|
return m + '\
|
||||||
|
if (state[i].next && RegExp(adjustedregex).test(""))\n\
|
||||||
|
rule._qre = RegExp(adjustedregex, "g");\n\
|
||||||
|
';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TokenizerModule.Tokenizer.prototype = proto;
|
||||||
|
patch(
|
||||||
|
proto, "getLineTokens",
|
||||||
|
/if \(match\[i \+ 1\] === undefined\)\s*continue;/,
|
||||||
|
"if (!match[i + 1]) {\n\
|
||||||
|
if (value)continue;\n\
|
||||||
|
var qre = state[mapping[i]]._qre;\n\
|
||||||
|
if (!qre) continue;\n\
|
||||||
|
qre.lastIndex = lastIndex;\n\
|
||||||
|
if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\
|
||||||
|
continue;\n\
|
||||||
|
}"
|
||||||
|
);
|
||||||
|
|
||||||
|
patch(
|
||||||
|
require("../mode/text").Mode.prototype, "getTokenizer",
|
||||||
|
/Tokenizer/,
|
||||||
|
"TokenizerModule.Tokenizer"
|
||||||
|
);
|
||||||
|
|
||||||
|
useragent.isOldIE = true;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var dom = require("../lib/dom");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var event = require("../lib/event");
|
||||||
|
var searchboxCss = "\
|
||||||
|
/* ------------------------------------------------------------------------------------------\
|
||||||
|
* Editor Search Form\
|
||||||
|
* --------------------------------------------------------------------------------------- */\
|
||||||
|
.ace_search {\
|
||||||
|
background-color: #ddd;\
|
||||||
|
border: 1px solid #cbcbcb;\
|
||||||
|
border-top: 0 none;\
|
||||||
|
max-width: 297px;\
|
||||||
|
overflow: hidden;\
|
||||||
|
margin: 0;\
|
||||||
|
padding: 4px;\
|
||||||
|
padding-right: 6px;\
|
||||||
|
padding-bottom: 0;\
|
||||||
|
position: absolute;\
|
||||||
|
top: 0px;\
|
||||||
|
z-index: 99;\
|
||||||
|
white-space: normal;\
|
||||||
|
}\
|
||||||
|
.ace_search.left {\
|
||||||
|
border-left: 0 none;\
|
||||||
|
border-radius: 0px 0px 5px 0px;\
|
||||||
|
left: 0;\
|
||||||
|
}\
|
||||||
|
.ace_search.right {\
|
||||||
|
border-radius: 0px 0px 0px 5px;\
|
||||||
|
border-right: 0 none;\
|
||||||
|
right: 0;\
|
||||||
|
}\
|
||||||
|
.ace_search_form, .ace_replace_form {\
|
||||||
|
border-radius: 3px;\
|
||||||
|
border: 1px solid #cbcbcb;\
|
||||||
|
float: left;\
|
||||||
|
margin-bottom: 4px;\
|
||||||
|
overflow: hidden;\
|
||||||
|
}\
|
||||||
|
.ace_search_form.ace_nomatch {\
|
||||||
|
outline: 1px solid red;\
|
||||||
|
}\
|
||||||
|
.ace_search_field {\
|
||||||
|
background-color: white;\
|
||||||
|
border-right: 1px solid #cbcbcb;\
|
||||||
|
border: 0 none;\
|
||||||
|
-webkit-box-sizing: border-box;\
|
||||||
|
-moz-box-sizing: border-box;\
|
||||||
|
box-sizing: border-box;\
|
||||||
|
display: block;\
|
||||||
|
float: left;\
|
||||||
|
height: 22px;\
|
||||||
|
outline: 0;\
|
||||||
|
padding: 0 7px;\
|
||||||
|
width: 214px;\
|
||||||
|
margin: 0;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn,\
|
||||||
|
.ace_replacebtn {\
|
||||||
|
background: #fff;\
|
||||||
|
border: 0 none;\
|
||||||
|
border-left: 1px solid #dcdcdc;\
|
||||||
|
cursor: pointer;\
|
||||||
|
display: block;\
|
||||||
|
float: left;\
|
||||||
|
height: 22px;\
|
||||||
|
margin: 0;\
|
||||||
|
padding: 0;\
|
||||||
|
position: relative;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn:last-child,\
|
||||||
|
.ace_replacebtn:last-child {\
|
||||||
|
border-top-right-radius: 3px;\
|
||||||
|
border-bottom-right-radius: 3px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn:disabled {\
|
||||||
|
background: none;\
|
||||||
|
cursor: default;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn {\
|
||||||
|
background-position: 50% 50%;\
|
||||||
|
background-repeat: no-repeat;\
|
||||||
|
width: 27px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn.prev {\
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \
|
||||||
|
}\
|
||||||
|
.ace_searchbtn.next {\
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \
|
||||||
|
}\
|
||||||
|
.ace_searchbtn_close {\
|
||||||
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
|
||||||
|
border-radius: 50%;\
|
||||||
|
border: 0 none;\
|
||||||
|
color: #656565;\
|
||||||
|
cursor: pointer;\
|
||||||
|
display: block;\
|
||||||
|
float: right;\
|
||||||
|
font-family: Arial;\
|
||||||
|
font-size: 16px;\
|
||||||
|
height: 14px;\
|
||||||
|
line-height: 16px;\
|
||||||
|
margin: 5px 1px 9px 5px;\
|
||||||
|
padding: 0;\
|
||||||
|
text-align: center;\
|
||||||
|
width: 14px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn_close:hover {\
|
||||||
|
background-color: #656565;\
|
||||||
|
background-position: 50% 100%;\
|
||||||
|
color: white;\
|
||||||
|
}\
|
||||||
|
.ace_replacebtn.prev {\
|
||||||
|
width: 54px\
|
||||||
|
}\
|
||||||
|
.ace_replacebtn.next {\
|
||||||
|
width: 27px\
|
||||||
|
}\
|
||||||
|
.ace_button {\
|
||||||
|
margin-left: 2px;\
|
||||||
|
cursor: pointer;\
|
||||||
|
-webkit-user-select: none;\
|
||||||
|
-moz-user-select: none;\
|
||||||
|
-o-user-select: none;\
|
||||||
|
-ms-user-select: none;\
|
||||||
|
user-select: none;\
|
||||||
|
overflow: hidden;\
|
||||||
|
opacity: 0.7;\
|
||||||
|
border: 1px solid rgba(100,100,100,0.23);\
|
||||||
|
padding: 1px;\
|
||||||
|
-moz-box-sizing: border-box;\
|
||||||
|
box-sizing: border-box;\
|
||||||
|
color: black;\
|
||||||
|
}\
|
||||||
|
.ace_button:hover {\
|
||||||
|
background-color: #eee;\
|
||||||
|
opacity:1;\
|
||||||
|
}\
|
||||||
|
.ace_button:active {\
|
||||||
|
background-color: #ddd;\
|
||||||
|
}\
|
||||||
|
.ace_button.checked {\
|
||||||
|
border-color: #3399ff;\
|
||||||
|
opacity:1;\
|
||||||
|
}\
|
||||||
|
.ace_search_options{\
|
||||||
|
margin-bottom: 3px;\
|
||||||
|
text-align: right;\
|
||||||
|
-webkit-user-select: none;\
|
||||||
|
-moz-user-select: none;\
|
||||||
|
-o-user-select: none;\
|
||||||
|
-ms-user-select: none;\
|
||||||
|
user-select: none;\
|
||||||
|
}";
|
||||||
|
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||||
|
var keyUtil = require("../lib/keys");
|
||||||
|
|
||||||
|
dom.importCssString(searchboxCss, "ace_searchbox");
|
||||||
|
|
||||||
|
var html = '<div class="ace_search right">\
|
||||||
|
<button type="button" action="hide" class="ace_searchbtn_close"></button>\
|
||||||
|
<div class="ace_search_form">\
|
||||||
|
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
||||||
|
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
||||||
|
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
||||||
|
</div>\
|
||||||
|
<div class="ace_replace_form">\
|
||||||
|
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||||
|
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
||||||
|
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
||||||
|
</div>\
|
||||||
|
<div class="ace_search_options">\
|
||||||
|
<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
|
||||||
|
<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
|
||||||
|
<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
|
||||||
|
</div>\
|
||||||
|
</div>'.replace(/>\s+/g, ">");
|
||||||
|
|
||||||
|
var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
|
var div = dom.createElement("div");
|
||||||
|
div.innerHTML = html;
|
||||||
|
this.element = div.firstChild;
|
||||||
|
|
||||||
|
this.$init();
|
||||||
|
this.setEditor(editor);
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.setEditor = function(editor) {
|
||||||
|
editor.searchBox = this;
|
||||||
|
editor.container.appendChild(this.element);
|
||||||
|
this.editor = editor;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$initElements = function(sb) {
|
||||||
|
this.searchBox = sb.querySelector(".ace_search_form");
|
||||||
|
this.replaceBox = sb.querySelector(".ace_replace_form");
|
||||||
|
this.searchOptions = sb.querySelector(".ace_search_options");
|
||||||
|
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
|
||||||
|
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
|
||||||
|
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
|
||||||
|
this.searchInput = this.searchBox.querySelector(".ace_search_field");
|
||||||
|
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$init = function() {
|
||||||
|
var sb = this.element;
|
||||||
|
|
||||||
|
this.$initElements(sb);
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
event.addListener(sb, "mousedown", function(e) {
|
||||||
|
setTimeout(function(){
|
||||||
|
_this.activeInput.focus();
|
||||||
|
}, 0);
|
||||||
|
event.stopPropagation(e);
|
||||||
|
});
|
||||||
|
event.addListener(sb, "click", function(e) {
|
||||||
|
var t = e.target || e.srcElement;
|
||||||
|
var action = t.getAttribute("action");
|
||||||
|
if (action && _this[action])
|
||||||
|
_this[action]();
|
||||||
|
else if (_this.$searchBarKb.commands[action])
|
||||||
|
_this.$searchBarKb.commands[action].exec(_this);
|
||||||
|
event.stopPropagation(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
|
||||||
|
var keyString = keyUtil.keyCodeToString(keyCode);
|
||||||
|
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
|
||||||
|
if (command && command.exec) {
|
||||||
|
command.exec(_this);
|
||||||
|
event.stopEvent(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$onChange = lang.delayedCall(function() {
|
||||||
|
_this.find(false, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.addListener(this.searchInput, "input", function() {
|
||||||
|
_this.$onChange.schedule(20);
|
||||||
|
});
|
||||||
|
event.addListener(this.searchInput, "focus", function() {
|
||||||
|
_this.activeInput = _this.searchInput;
|
||||||
|
_this.searchInput.value && _this.highlight();
|
||||||
|
});
|
||||||
|
event.addListener(this.replaceInput, "focus", function() {
|
||||||
|
_this.activeInput = _this.replaceInput;
|
||||||
|
_this.searchInput.value && _this.highlight();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
this.$closeSearchBarKb = new HashHandler([{
|
||||||
|
bindKey: "Esc",
|
||||||
|
name: "closeSearchBar",
|
||||||
|
exec: function(editor) {
|
||||||
|
editor.searchBox.hide();
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
this.$searchBarKb = new HashHandler();
|
||||||
|
this.$searchBarKb.bindKeys({
|
||||||
|
"Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
|
||||||
|
var isReplace = sb.isReplace = !sb.isReplace;
|
||||||
|
sb.replaceBox.style.display = isReplace ? "" : "none";
|
||||||
|
sb[isReplace ? "replaceInput" : "searchInput"].focus();
|
||||||
|
},
|
||||||
|
"Ctrl-G|Command-G": function(sb) {
|
||||||
|
sb.findNext();
|
||||||
|
},
|
||||||
|
"Ctrl-Shift-G|Command-Shift-G": function(sb) {
|
||||||
|
sb.findPrev();
|
||||||
|
},
|
||||||
|
"esc": function(sb) {
|
||||||
|
setTimeout(function() { sb.hide();});
|
||||||
|
},
|
||||||
|
"Return": function(sb) {
|
||||||
|
if (sb.activeInput == sb.replaceInput)
|
||||||
|
sb.replace();
|
||||||
|
sb.findNext();
|
||||||
|
},
|
||||||
|
"Shift-Return": function(sb) {
|
||||||
|
if (sb.activeInput == sb.replaceInput)
|
||||||
|
sb.replace();
|
||||||
|
sb.findPrev();
|
||||||
|
},
|
||||||
|
"Tab": function(sb) {
|
||||||
|
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$searchBarKb.addCommands([{
|
||||||
|
name: "toggleRegexpMode",
|
||||||
|
bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.regExpOption.checked = !sb.regExpOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "toggleCaseSensitive",
|
||||||
|
bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "toggleWholeWords",
|
||||||
|
bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
this.$syncOptions = function() {
|
||||||
|
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
|
||||||
|
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
|
||||||
|
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
|
||||||
|
this.find(false, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.highlight = function(re) {
|
||||||
|
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
||||||
|
this.editor.renderer.updateBackMarkers()
|
||||||
|
};
|
||||||
|
this.find = function(skipCurrent, backwards) {
|
||||||
|
var range = this.editor.find(this.searchInput.value, {
|
||||||
|
skipCurrent: skipCurrent,
|
||||||
|
backwards: backwards,
|
||||||
|
wrap: true,
|
||||||
|
regExp: this.regExpOption.checked,
|
||||||
|
caseSensitive: this.caseSensitiveOption.checked,
|
||||||
|
wholeWord: this.wholeWordOption.checked
|
||||||
|
});
|
||||||
|
var noMatch = !range && this.searchInput.value;
|
||||||
|
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||||
|
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||||
|
this.highlight();
|
||||||
|
};
|
||||||
|
this.findNext = function() {
|
||||||
|
this.find(true, false);
|
||||||
|
};
|
||||||
|
this.findPrev = function() {
|
||||||
|
this.find(true, true);
|
||||||
|
};
|
||||||
|
this.replace = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
};
|
||||||
|
this.replaceAndFindNext = function() {
|
||||||
|
if (!this.editor.getReadOnly()) {
|
||||||
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
this.findNext()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.replaceAll = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
|
this.editor.replaceAll(this.replaceInput.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hide = function() {
|
||||||
|
this.element.style.display = "none";
|
||||||
|
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
||||||
|
this.editor.focus();
|
||||||
|
};
|
||||||
|
this.show = function(value, isReplace) {
|
||||||
|
this.element.style.display = "";
|
||||||
|
this.replaceBox.style.display = isReplace ? "" : "none";
|
||||||
|
|
||||||
|
this.isReplace = isReplace;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
this.searchInput.value = value;
|
||||||
|
this.searchInput.focus();
|
||||||
|
this.searchInput.select();
|
||||||
|
|
||||||
|
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(SearchBox.prototype);
|
||||||
|
|
||||||
|
exports.SearchBox = SearchBox;
|
||||||
|
|
||||||
|
exports.Search = function(editor, isReplace) {
|
||||||
|
var sb = editor.searchBox || new SearchBox(editor);
|
||||||
|
sb.show(editor.session.getTextRange(), isReplace);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
421
src/main/webapp/assets/ace/ext-searchbox.js
Normal file
421
src/main/webapp/assets/ace/ext-searchbox.js
Normal file
@@ -0,0 +1,421 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var dom = require("../lib/dom");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var event = require("../lib/event");
|
||||||
|
var searchboxCss = "\
|
||||||
|
/* ------------------------------------------------------------------------------------------\
|
||||||
|
* Editor Search Form\
|
||||||
|
* --------------------------------------------------------------------------------------- */\
|
||||||
|
.ace_search {\
|
||||||
|
background-color: #ddd;\
|
||||||
|
border: 1px solid #cbcbcb;\
|
||||||
|
border-top: 0 none;\
|
||||||
|
max-width: 297px;\
|
||||||
|
overflow: hidden;\
|
||||||
|
margin: 0;\
|
||||||
|
padding: 4px;\
|
||||||
|
padding-right: 6px;\
|
||||||
|
padding-bottom: 0;\
|
||||||
|
position: absolute;\
|
||||||
|
top: 0px;\
|
||||||
|
z-index: 99;\
|
||||||
|
white-space: normal;\
|
||||||
|
}\
|
||||||
|
.ace_search.left {\
|
||||||
|
border-left: 0 none;\
|
||||||
|
border-radius: 0px 0px 5px 0px;\
|
||||||
|
left: 0;\
|
||||||
|
}\
|
||||||
|
.ace_search.right {\
|
||||||
|
border-radius: 0px 0px 0px 5px;\
|
||||||
|
border-right: 0 none;\
|
||||||
|
right: 0;\
|
||||||
|
}\
|
||||||
|
.ace_search_form, .ace_replace_form {\
|
||||||
|
border-radius: 3px;\
|
||||||
|
border: 1px solid #cbcbcb;\
|
||||||
|
float: left;\
|
||||||
|
margin-bottom: 4px;\
|
||||||
|
overflow: hidden;\
|
||||||
|
}\
|
||||||
|
.ace_search_form.ace_nomatch {\
|
||||||
|
outline: 1px solid red;\
|
||||||
|
}\
|
||||||
|
.ace_search_field {\
|
||||||
|
background-color: white;\
|
||||||
|
border-right: 1px solid #cbcbcb;\
|
||||||
|
border: 0 none;\
|
||||||
|
-webkit-box-sizing: border-box;\
|
||||||
|
-moz-box-sizing: border-box;\
|
||||||
|
box-sizing: border-box;\
|
||||||
|
display: block;\
|
||||||
|
float: left;\
|
||||||
|
height: 22px;\
|
||||||
|
outline: 0;\
|
||||||
|
padding: 0 7px;\
|
||||||
|
width: 214px;\
|
||||||
|
margin: 0;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn,\
|
||||||
|
.ace_replacebtn {\
|
||||||
|
background: #fff;\
|
||||||
|
border: 0 none;\
|
||||||
|
border-left: 1px solid #dcdcdc;\
|
||||||
|
cursor: pointer;\
|
||||||
|
display: block;\
|
||||||
|
float: left;\
|
||||||
|
height: 22px;\
|
||||||
|
margin: 0;\
|
||||||
|
padding: 0;\
|
||||||
|
position: relative;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn:last-child,\
|
||||||
|
.ace_replacebtn:last-child {\
|
||||||
|
border-top-right-radius: 3px;\
|
||||||
|
border-bottom-right-radius: 3px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn:disabled {\
|
||||||
|
background: none;\
|
||||||
|
cursor: default;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn {\
|
||||||
|
background-position: 50% 50%;\
|
||||||
|
background-repeat: no-repeat;\
|
||||||
|
width: 27px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn.prev {\
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \
|
||||||
|
}\
|
||||||
|
.ace_searchbtn.next {\
|
||||||
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \
|
||||||
|
}\
|
||||||
|
.ace_searchbtn_close {\
|
||||||
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
|
||||||
|
border-radius: 50%;\
|
||||||
|
border: 0 none;\
|
||||||
|
color: #656565;\
|
||||||
|
cursor: pointer;\
|
||||||
|
display: block;\
|
||||||
|
float: right;\
|
||||||
|
font-family: Arial;\
|
||||||
|
font-size: 16px;\
|
||||||
|
height: 14px;\
|
||||||
|
line-height: 16px;\
|
||||||
|
margin: 5px 1px 9px 5px;\
|
||||||
|
padding: 0;\
|
||||||
|
text-align: center;\
|
||||||
|
width: 14px;\
|
||||||
|
}\
|
||||||
|
.ace_searchbtn_close:hover {\
|
||||||
|
background-color: #656565;\
|
||||||
|
background-position: 50% 100%;\
|
||||||
|
color: white;\
|
||||||
|
}\
|
||||||
|
.ace_replacebtn.prev {\
|
||||||
|
width: 54px\
|
||||||
|
}\
|
||||||
|
.ace_replacebtn.next {\
|
||||||
|
width: 27px\
|
||||||
|
}\
|
||||||
|
.ace_button {\
|
||||||
|
margin-left: 2px;\
|
||||||
|
cursor: pointer;\
|
||||||
|
-webkit-user-select: none;\
|
||||||
|
-moz-user-select: none;\
|
||||||
|
-o-user-select: none;\
|
||||||
|
-ms-user-select: none;\
|
||||||
|
user-select: none;\
|
||||||
|
overflow: hidden;\
|
||||||
|
opacity: 0.7;\
|
||||||
|
border: 1px solid rgba(100,100,100,0.23);\
|
||||||
|
padding: 1px;\
|
||||||
|
-moz-box-sizing: border-box;\
|
||||||
|
box-sizing: border-box;\
|
||||||
|
color: black;\
|
||||||
|
}\
|
||||||
|
.ace_button:hover {\
|
||||||
|
background-color: #eee;\
|
||||||
|
opacity:1;\
|
||||||
|
}\
|
||||||
|
.ace_button:active {\
|
||||||
|
background-color: #ddd;\
|
||||||
|
}\
|
||||||
|
.ace_button.checked {\
|
||||||
|
border-color: #3399ff;\
|
||||||
|
opacity:1;\
|
||||||
|
}\
|
||||||
|
.ace_search_options{\
|
||||||
|
margin-bottom: 3px;\
|
||||||
|
text-align: right;\
|
||||||
|
-webkit-user-select: none;\
|
||||||
|
-moz-user-select: none;\
|
||||||
|
-o-user-select: none;\
|
||||||
|
-ms-user-select: none;\
|
||||||
|
user-select: none;\
|
||||||
|
}";
|
||||||
|
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||||
|
var keyUtil = require("../lib/keys");
|
||||||
|
|
||||||
|
dom.importCssString(searchboxCss, "ace_searchbox");
|
||||||
|
|
||||||
|
var html = '<div class="ace_search right">\
|
||||||
|
<button type="button" action="hide" class="ace_searchbtn_close"></button>\
|
||||||
|
<div class="ace_search_form">\
|
||||||
|
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
||||||
|
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
||||||
|
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
||||||
|
</div>\
|
||||||
|
<div class="ace_replace_form">\
|
||||||
|
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||||
|
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
||||||
|
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
||||||
|
</div>\
|
||||||
|
<div class="ace_search_options">\
|
||||||
|
<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
|
||||||
|
<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
|
||||||
|
<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
|
||||||
|
</div>\
|
||||||
|
</div>'.replace(/>\s+/g, ">");
|
||||||
|
|
||||||
|
var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
|
var div = dom.createElement("div");
|
||||||
|
div.innerHTML = html;
|
||||||
|
this.element = div.firstChild;
|
||||||
|
|
||||||
|
this.$init();
|
||||||
|
this.setEditor(editor);
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.setEditor = function(editor) {
|
||||||
|
editor.searchBox = this;
|
||||||
|
editor.container.appendChild(this.element);
|
||||||
|
this.editor = editor;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$initElements = function(sb) {
|
||||||
|
this.searchBox = sb.querySelector(".ace_search_form");
|
||||||
|
this.replaceBox = sb.querySelector(".ace_replace_form");
|
||||||
|
this.searchOptions = sb.querySelector(".ace_search_options");
|
||||||
|
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
|
||||||
|
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
|
||||||
|
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
|
||||||
|
this.searchInput = this.searchBox.querySelector(".ace_search_field");
|
||||||
|
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$init = function() {
|
||||||
|
var sb = this.element;
|
||||||
|
|
||||||
|
this.$initElements(sb);
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
event.addListener(sb, "mousedown", function(e) {
|
||||||
|
setTimeout(function(){
|
||||||
|
_this.activeInput.focus();
|
||||||
|
}, 0);
|
||||||
|
event.stopPropagation(e);
|
||||||
|
});
|
||||||
|
event.addListener(sb, "click", function(e) {
|
||||||
|
var t = e.target || e.srcElement;
|
||||||
|
var action = t.getAttribute("action");
|
||||||
|
if (action && _this[action])
|
||||||
|
_this[action]();
|
||||||
|
else if (_this.$searchBarKb.commands[action])
|
||||||
|
_this.$searchBarKb.commands[action].exec(_this);
|
||||||
|
event.stopPropagation(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
|
||||||
|
var keyString = keyUtil.keyCodeToString(keyCode);
|
||||||
|
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
|
||||||
|
if (command && command.exec) {
|
||||||
|
command.exec(_this);
|
||||||
|
event.stopEvent(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$onChange = lang.delayedCall(function() {
|
||||||
|
_this.find(false, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.addListener(this.searchInput, "input", function() {
|
||||||
|
_this.$onChange.schedule(20);
|
||||||
|
});
|
||||||
|
event.addListener(this.searchInput, "focus", function() {
|
||||||
|
_this.activeInput = _this.searchInput;
|
||||||
|
_this.searchInput.value && _this.highlight();
|
||||||
|
});
|
||||||
|
event.addListener(this.replaceInput, "focus", function() {
|
||||||
|
_this.activeInput = _this.replaceInput;
|
||||||
|
_this.searchInput.value && _this.highlight();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
this.$closeSearchBarKb = new HashHandler([{
|
||||||
|
bindKey: "Esc",
|
||||||
|
name: "closeSearchBar",
|
||||||
|
exec: function(editor) {
|
||||||
|
editor.searchBox.hide();
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
this.$searchBarKb = new HashHandler();
|
||||||
|
this.$searchBarKb.bindKeys({
|
||||||
|
"Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
|
||||||
|
var isReplace = sb.isReplace = !sb.isReplace;
|
||||||
|
sb.replaceBox.style.display = isReplace ? "" : "none";
|
||||||
|
sb[isReplace ? "replaceInput" : "searchInput"].focus();
|
||||||
|
},
|
||||||
|
"Ctrl-G|Command-G": function(sb) {
|
||||||
|
sb.findNext();
|
||||||
|
},
|
||||||
|
"Ctrl-Shift-G|Command-Shift-G": function(sb) {
|
||||||
|
sb.findPrev();
|
||||||
|
},
|
||||||
|
"esc": function(sb) {
|
||||||
|
setTimeout(function() { sb.hide();});
|
||||||
|
},
|
||||||
|
"Return": function(sb) {
|
||||||
|
if (sb.activeInput == sb.replaceInput)
|
||||||
|
sb.replace();
|
||||||
|
sb.findNext();
|
||||||
|
},
|
||||||
|
"Shift-Return": function(sb) {
|
||||||
|
if (sb.activeInput == sb.replaceInput)
|
||||||
|
sb.replace();
|
||||||
|
sb.findPrev();
|
||||||
|
},
|
||||||
|
"Tab": function(sb) {
|
||||||
|
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$searchBarKb.addCommands([{
|
||||||
|
name: "toggleRegexpMode",
|
||||||
|
bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.regExpOption.checked = !sb.regExpOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "toggleCaseSensitive",
|
||||||
|
bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "toggleWholeWords",
|
||||||
|
bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
|
||||||
|
exec: function(sb) {
|
||||||
|
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
|
||||||
|
sb.$syncOptions();
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
this.$syncOptions = function() {
|
||||||
|
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
|
||||||
|
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
|
||||||
|
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
|
||||||
|
this.find(false, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.highlight = function(re) {
|
||||||
|
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
||||||
|
this.editor.renderer.updateBackMarkers()
|
||||||
|
};
|
||||||
|
this.find = function(skipCurrent, backwards) {
|
||||||
|
var range = this.editor.find(this.searchInput.value, {
|
||||||
|
skipCurrent: skipCurrent,
|
||||||
|
backwards: backwards,
|
||||||
|
wrap: true,
|
||||||
|
regExp: this.regExpOption.checked,
|
||||||
|
caseSensitive: this.caseSensitiveOption.checked,
|
||||||
|
wholeWord: this.wholeWordOption.checked
|
||||||
|
});
|
||||||
|
var noMatch = !range && this.searchInput.value;
|
||||||
|
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||||
|
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||||
|
this.highlight();
|
||||||
|
};
|
||||||
|
this.findNext = function() {
|
||||||
|
this.find(true, false);
|
||||||
|
};
|
||||||
|
this.findPrev = function() {
|
||||||
|
this.find(true, true);
|
||||||
|
};
|
||||||
|
this.replace = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
};
|
||||||
|
this.replaceAndFindNext = function() {
|
||||||
|
if (!this.editor.getReadOnly()) {
|
||||||
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
this.findNext()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.replaceAll = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
|
this.editor.replaceAll(this.replaceInput.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hide = function() {
|
||||||
|
this.element.style.display = "none";
|
||||||
|
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
||||||
|
this.editor.focus();
|
||||||
|
};
|
||||||
|
this.show = function(value, isReplace) {
|
||||||
|
this.element.style.display = "";
|
||||||
|
this.replaceBox.style.display = isReplace ? "" : "none";
|
||||||
|
|
||||||
|
this.isReplace = isReplace;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
this.searchInput.value = value;
|
||||||
|
this.searchInput.focus();
|
||||||
|
this.searchInput.select();
|
||||||
|
|
||||||
|
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(SearchBox.prototype);
|
||||||
|
|
||||||
|
exports.SearchBox = SearchBox;
|
||||||
|
|
||||||
|
exports.Search = function(editor, isReplace) {
|
||||||
|
var sb = editor.searchBox || new SearchBox(editor);
|
||||||
|
sb.show(editor.session.getTextRange(), isReplace);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
636
src/main/webapp/assets/ace/ext-settings_menu.js
Normal file
636
src/main/webapp/assets/ace/ext-settings_menu.js
Normal file
@@ -0,0 +1,636 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Contributed to Ajax.org under the BSD license.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/generate_settings_menu', 'ace/ext/menu_tools/overlay_page', 'ace/editor'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
|
||||||
|
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
|
||||||
|
function showSettingsMenu(editor) {
|
||||||
|
var sm = document.getElementById('ace_settingsmenu');
|
||||||
|
if (!sm)
|
||||||
|
overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
|
||||||
|
}
|
||||||
|
module.exports.init = function(editor) {
|
||||||
|
var Editor = require("ace/editor").Editor;
|
||||||
|
Editor.prototype.showSettingsMenu = function() {
|
||||||
|
showSettingsMenu(this);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/generate_settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/element_generator', 'ace/ext/menu_tools/add_editor_menu_options', 'ace/ext/menu_tools/get_set_functions'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var egen = require('./element_generator');
|
||||||
|
var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
|
||||||
|
var getSetFunctions = require('./get_set_functions').getSetFunctions;
|
||||||
|
module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
||||||
|
var elements = [];
|
||||||
|
function cleanupElementsList() {
|
||||||
|
elements.sort(function(a, b) {
|
||||||
|
var x = a.getAttribute('contains');
|
||||||
|
var y = b.getAttribute('contains');
|
||||||
|
return x.localeCompare(y);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function wrapElements() {
|
||||||
|
var topmenu = document.createElement('div');
|
||||||
|
topmenu.setAttribute('id', 'ace_settingsmenu');
|
||||||
|
elements.forEach(function(element) {
|
||||||
|
topmenu.appendChild(element);
|
||||||
|
});
|
||||||
|
return topmenu;
|
||||||
|
}
|
||||||
|
function createNewEntry(obj, clss, item, val) {
|
||||||
|
var el;
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.setAttribute('contains', item);
|
||||||
|
div.setAttribute('class', 'ace_optionsMenuEntry');
|
||||||
|
div.setAttribute('style', 'clear: both;');
|
||||||
|
|
||||||
|
div.appendChild(egen.createLabel(
|
||||||
|
item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
|
||||||
|
item
|
||||||
|
));
|
||||||
|
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
el = egen.createSelection(item, val, clss);
|
||||||
|
el.addEventListener('change', function(e) {
|
||||||
|
try{
|
||||||
|
editor.menuOptions[e.target.id].forEach(function(x) {
|
||||||
|
if(x.textContent !== e.target.textContent) {
|
||||||
|
delete x.selected;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
obj[e.target.id](e.target.value);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(typeof val === 'boolean') {
|
||||||
|
el = egen.createCheckbox(item, val, clss);
|
||||||
|
el.addEventListener('change', function(e) {
|
||||||
|
try{
|
||||||
|
obj[e.target.id](!!e.target.checked);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
el = egen.createInput(item, val, clss);
|
||||||
|
el.addEventListener('change', function(e) {
|
||||||
|
try{
|
||||||
|
if(e.target.value === 'true') {
|
||||||
|
obj[e.target.id](true);
|
||||||
|
} else if(e.target.value === 'false') {
|
||||||
|
obj[e.target.id](false);
|
||||||
|
} else {
|
||||||
|
obj[e.target.id](e.target.value);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
el.style.cssText = 'float:right;';
|
||||||
|
div.appendChild(el);
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
function makeDropdown(item, esr, clss, fn) {
|
||||||
|
var val = editor.menuOptions[item];
|
||||||
|
var currentVal = esr[fn]();
|
||||||
|
if (typeof currentVal == 'object')
|
||||||
|
currentVal = currentVal.$id;
|
||||||
|
val.forEach(function(valuex) {
|
||||||
|
if (valuex.value === currentVal)
|
||||||
|
valuex.selected = 'selected';
|
||||||
|
});
|
||||||
|
return createNewEntry(esr, clss, item, val);
|
||||||
|
}
|
||||||
|
function handleSet(setObj) {
|
||||||
|
var item = setObj.functionName;
|
||||||
|
var esr = setObj.parentObj;
|
||||||
|
var clss = setObj.parentName;
|
||||||
|
var val;
|
||||||
|
var fn = item.replace(/^set/, 'get');
|
||||||
|
if(editor.menuOptions[item] !== undefined) {
|
||||||
|
elements.push(makeDropdown(item, esr, clss, fn));
|
||||||
|
} else if(typeof esr[fn] === 'function') {
|
||||||
|
try {
|
||||||
|
val = esr[fn]();
|
||||||
|
if(typeof val === 'object') {
|
||||||
|
val = val.$id;
|
||||||
|
}
|
||||||
|
elements.push(
|
||||||
|
createNewEntry(esr, clss, item, val)
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addEditorMenuOptions(editor);
|
||||||
|
getSetFunctions(editor).forEach(function(setObj) {
|
||||||
|
handleSet(setObj);
|
||||||
|
});
|
||||||
|
cleanupElementsList();
|
||||||
|
return wrapElements();
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/element_generator', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||||
|
module.exports.createOption = function createOption (obj) {
|
||||||
|
var attribute;
|
||||||
|
var el = document.createElement('option');
|
||||||
|
for(attribute in obj) {
|
||||||
|
if(obj.hasOwnProperty(attribute)) {
|
||||||
|
if(attribute === 'selected') {
|
||||||
|
el.setAttribute(attribute, obj[attribute]);
|
||||||
|
} else {
|
||||||
|
el[attribute] = obj[attribute];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
|
||||||
|
var el = document.createElement('input');
|
||||||
|
el.setAttribute('type', 'checkbox');
|
||||||
|
el.setAttribute('id', id);
|
||||||
|
el.setAttribute('name', id);
|
||||||
|
el.setAttribute('value', checked);
|
||||||
|
el.setAttribute('class', clss);
|
||||||
|
if(checked) {
|
||||||
|
el.setAttribute('checked', 'checked');
|
||||||
|
}
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
module.exports.createInput = function createInput (id, value, clss) {
|
||||||
|
var el = document.createElement('input');
|
||||||
|
el.setAttribute('type', 'text');
|
||||||
|
el.setAttribute('id', id);
|
||||||
|
el.setAttribute('name', id);
|
||||||
|
el.setAttribute('value', value);
|
||||||
|
el.setAttribute('class', clss);
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
module.exports.createLabel = function createLabel (text, labelFor) {
|
||||||
|
var el = document.createElement('label');
|
||||||
|
el.setAttribute('for', labelFor);
|
||||||
|
el.textContent = text;
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
module.exports.createSelection = function createSelection (id, values, clss) {
|
||||||
|
var el = document.createElement('select');
|
||||||
|
el.setAttribute('id', id);
|
||||||
|
el.setAttribute('name', id);
|
||||||
|
el.setAttribute('class', clss);
|
||||||
|
values.forEach(function(item) {
|
||||||
|
el.appendChild(module.exports.createOption(item));
|
||||||
|
});
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/add_editor_menu_options', ['require', 'exports', 'module' , 'ace/ext/modelist', 'ace/ext/themelist'], function(require, exports, module) {
|
||||||
|
module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
|
||||||
|
var modelist = require('../modelist');
|
||||||
|
var themelist = require('../themelist');
|
||||||
|
editor.menuOptions = {
|
||||||
|
"setNewLineMode" : [{
|
||||||
|
"textContent" : "unix",
|
||||||
|
"value" : "unix"
|
||||||
|
}, {
|
||||||
|
"textContent" : "windows",
|
||||||
|
"value" : "windows"
|
||||||
|
}, {
|
||||||
|
"textContent" : "auto",
|
||||||
|
"value" : "auto"
|
||||||
|
}],
|
||||||
|
"setTheme" : [],
|
||||||
|
"setMode" : [],
|
||||||
|
"setKeyboardHandler": [{
|
||||||
|
"textContent" : "ace",
|
||||||
|
"value" : ""
|
||||||
|
}, {
|
||||||
|
"textContent" : "vim",
|
||||||
|
"value" : "ace/keyboard/vim"
|
||||||
|
}, {
|
||||||
|
"textContent" : "emacs",
|
||||||
|
"value" : "ace/keyboard/emacs"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
|
||||||
|
return {
|
||||||
|
'textContent' : theme.caption,
|
||||||
|
'value' : theme.theme
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.menuOptions.setMode = modelist.modes.map(function(mode) {
|
||||||
|
return {
|
||||||
|
'textContent' : mode.name,
|
||||||
|
'value' : mode.mode
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
ace.define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var modes = [];
|
||||||
|
function getModeForPath(path) {
|
||||||
|
var mode = modesByName.text;
|
||||||
|
var fileName = path.split(/[\/\\]/).pop();
|
||||||
|
for (var i = 0; i < modes.length; i++) {
|
||||||
|
if (modes[i].supportsFile(fileName)) {
|
||||||
|
mode = modes[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Mode = function(name, caption, extensions) {
|
||||||
|
this.name = name;
|
||||||
|
this.caption = caption;
|
||||||
|
this.mode = "ace/mode/" + name;
|
||||||
|
this.extensions = extensions;
|
||||||
|
if (/\^/.test(extensions)) {
|
||||||
|
var re = extensions.replace(/\|(\^)?/g, function(a, b){
|
||||||
|
return "$|" + (b ? "^" : "^.*\\.");
|
||||||
|
}) + "$";
|
||||||
|
} else {
|
||||||
|
var re = "^.*\\.(" + extensions + ")$";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.extRe = new RegExp(re, "gi");
|
||||||
|
};
|
||||||
|
|
||||||
|
Mode.prototype.supportsFile = function(filename) {
|
||||||
|
return filename.match(this.extRe);
|
||||||
|
};
|
||||||
|
var supportedModes = {
|
||||||
|
ABAP: ["abap"],
|
||||||
|
ActionScript:["as"],
|
||||||
|
ADA: ["ada|adb"],
|
||||||
|
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
|
||||||
|
AsciiDoc: ["asciidoc"],
|
||||||
|
Assembly_x86:["asm"],
|
||||||
|
AutoHotKey: ["ahk"],
|
||||||
|
BatchFile: ["bat|cmd"],
|
||||||
|
C9Search: ["c9search_results"],
|
||||||
|
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
||||||
|
Cirru: ["cirru|cr"],
|
||||||
|
Clojure: ["clj"],
|
||||||
|
Cobol: ["CBL|COB"],
|
||||||
|
coffee: ["coffee|cf|cson|^Cakefile"],
|
||||||
|
ColdFusion: ["cfm"],
|
||||||
|
CSharp: ["cs"],
|
||||||
|
CSS: ["css"],
|
||||||
|
Curly: ["curly"],
|
||||||
|
D: ["d|di"],
|
||||||
|
Dart: ["dart"],
|
||||||
|
Diff: ["diff|patch"],
|
||||||
|
Dot: ["dot"],
|
||||||
|
Erlang: ["erl|hrl"],
|
||||||
|
EJS: ["ejs"],
|
||||||
|
Forth: ["frt|fs|ldr"],
|
||||||
|
FTL: ["ftl"],
|
||||||
|
Gherkin: ["feature"],
|
||||||
|
Glsl: ["glsl|frag|vert"],
|
||||||
|
golang: ["go"],
|
||||||
|
Groovy: ["groovy"],
|
||||||
|
HAML: ["haml"],
|
||||||
|
Handlebars: ["hbs|handlebars|tpl|mustache"],
|
||||||
|
Haskell: ["hs"],
|
||||||
|
haXe: ["hx"],
|
||||||
|
HTML: ["html|htm|xhtml"],
|
||||||
|
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||||
|
INI: ["ini|conf|cfg|prefs"],
|
||||||
|
Jack: ["jack"],
|
||||||
|
Jade: ["jade"],
|
||||||
|
Java: ["java"],
|
||||||
|
JavaScript: ["js|jsm"],
|
||||||
|
JSON: ["json"],
|
||||||
|
JSONiq: ["jq"],
|
||||||
|
JSP: ["jsp"],
|
||||||
|
JSX: ["jsx"],
|
||||||
|
Julia: ["jl"],
|
||||||
|
LaTeX: ["tex|latex|ltx|bib"],
|
||||||
|
LESS: ["less"],
|
||||||
|
Liquid: ["liquid"],
|
||||||
|
Lisp: ["lisp"],
|
||||||
|
LiveScript: ["ls"],
|
||||||
|
LogiQL: ["logic|lql"],
|
||||||
|
LSL: ["lsl"],
|
||||||
|
Lua: ["lua"],
|
||||||
|
LuaPage: ["lp"],
|
||||||
|
Lucene: ["lucene"],
|
||||||
|
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
||||||
|
MATLAB: ["matlab"],
|
||||||
|
Markdown: ["md|markdown"],
|
||||||
|
MEL: ["mel"],
|
||||||
|
MySQL: ["mysql"],
|
||||||
|
MUSHCode: ["mc|mush"],
|
||||||
|
Nix: ["nix"],
|
||||||
|
ObjectiveC: ["m|mm"],
|
||||||
|
OCaml: ["ml|mli"],
|
||||||
|
Pascal: ["pas|p"],
|
||||||
|
Perl: ["pl|pm"],
|
||||||
|
pgSQL: ["pgsql"],
|
||||||
|
PHP: ["php|phtml"],
|
||||||
|
Powershell: ["ps1"],
|
||||||
|
Prolog: ["plg|prolog"],
|
||||||
|
Properties: ["properties"],
|
||||||
|
Protobuf: ["proto"],
|
||||||
|
Python: ["py"],
|
||||||
|
R: ["r"],
|
||||||
|
RDoc: ["Rd"],
|
||||||
|
RHTML: ["Rhtml"],
|
||||||
|
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
|
||||||
|
Rust: ["rs"],
|
||||||
|
SASS: ["sass"],
|
||||||
|
SCAD: ["scad"],
|
||||||
|
Scala: ["scala"],
|
||||||
|
Smarty: ["smarty|tpl"],
|
||||||
|
Scheme: ["scm|rkt"],
|
||||||
|
SCSS: ["scss"],
|
||||||
|
SH: ["sh|bash|^.bashrc"],
|
||||||
|
SJS: ["sjs"],
|
||||||
|
Space: ["space"],
|
||||||
|
snippets: ["snippets"],
|
||||||
|
Soy_Template:["soy"],
|
||||||
|
SQL: ["sql"],
|
||||||
|
Stylus: ["styl|stylus"],
|
||||||
|
SVG: ["svg"],
|
||||||
|
Tcl: ["tcl"],
|
||||||
|
Tex: ["tex"],
|
||||||
|
Text: ["txt"],
|
||||||
|
Textile: ["textile"],
|
||||||
|
Toml: ["toml"],
|
||||||
|
Twig: ["twig"],
|
||||||
|
Typescript: ["ts|typescript|str"],
|
||||||
|
VBScript: ["vbs"],
|
||||||
|
Velocity: ["vm"],
|
||||||
|
Verilog: ["v|vh|sv|svh"],
|
||||||
|
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||||
|
XQuery: ["xq"],
|
||||||
|
YAML: ["yaml|yml"]
|
||||||
|
};
|
||||||
|
|
||||||
|
var nameOverrides = {
|
||||||
|
ObjectiveC: "Objective-C",
|
||||||
|
CSharp: "C#",
|
||||||
|
golang: "Go",
|
||||||
|
C_Cpp: "C/C++",
|
||||||
|
coffee: "CoffeeScript",
|
||||||
|
HTML_Ruby: "HTML (Ruby)",
|
||||||
|
FTL: "FreeMarker"
|
||||||
|
};
|
||||||
|
var modesByName = {};
|
||||||
|
for (var name in supportedModes) {
|
||||||
|
var data = supportedModes[name];
|
||||||
|
var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
|
||||||
|
var filename = name.toLowerCase();
|
||||||
|
var mode = new Mode(filename, displayName, data[0]);
|
||||||
|
modesByName[filename] = mode;
|
||||||
|
modes.push(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getModeForPath: getModeForPath,
|
||||||
|
modes: modes,
|
||||||
|
modesByName: modesByName
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers'], function(require, exports, module) {
|
||||||
|
|
||||||
|
require("ace/lib/fixoldbrowsers");
|
||||||
|
|
||||||
|
var themeData = [
|
||||||
|
["Chrome" ],
|
||||||
|
["Clouds" ],
|
||||||
|
["Crimson Editor" ],
|
||||||
|
["Dawn" ],
|
||||||
|
["Dreamweaver" ],
|
||||||
|
["Eclipse" ],
|
||||||
|
["GitHub" ],
|
||||||
|
["Solarized Light"],
|
||||||
|
["TextMate" ],
|
||||||
|
["Tomorrow" ],
|
||||||
|
["XCode" ],
|
||||||
|
["Kuroir"],
|
||||||
|
["KatzenMilch"],
|
||||||
|
["Ambiance" ,"ambiance" , "dark"],
|
||||||
|
["Chaos" ,"chaos" , "dark"],
|
||||||
|
["Clouds Midnight" ,"clouds_midnight" , "dark"],
|
||||||
|
["Cobalt" ,"cobalt" , "dark"],
|
||||||
|
["idle Fingers" ,"idle_fingers" , "dark"],
|
||||||
|
["krTheme" ,"kr_theme" , "dark"],
|
||||||
|
["Merbivore" ,"merbivore" , "dark"],
|
||||||
|
["Merbivore Soft" ,"merbivore_soft" , "dark"],
|
||||||
|
["Mono Industrial" ,"mono_industrial" , "dark"],
|
||||||
|
["Monokai" ,"monokai" , "dark"],
|
||||||
|
["Pastel on dark" ,"pastel_on_dark" , "dark"],
|
||||||
|
["Solarized Dark" ,"solarized_dark" , "dark"],
|
||||||
|
["Terminal" ,"terminal" , "dark"],
|
||||||
|
["Tomorrow Night" ,"tomorrow_night" , "dark"],
|
||||||
|
["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
|
||||||
|
["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
|
||||||
|
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
|
||||||
|
["Twilight" ,"twilight" , "dark"],
|
||||||
|
["Vibrant Ink" ,"vibrant_ink" , "dark"]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
exports.themesByName = {};
|
||||||
|
exports.themes = themeData.map(function(data) {
|
||||||
|
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
|
||||||
|
var theme = {
|
||||||
|
caption: data[0],
|
||||||
|
theme: "ace/theme/" + name,
|
||||||
|
isDark: data[2] == "dark",
|
||||||
|
name: name
|
||||||
|
};
|
||||||
|
exports.themesByName[name] = theme;
|
||||||
|
return theme;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/get_set_functions', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||||
|
module.exports.getSetFunctions = function getSetFunctions (editor) {
|
||||||
|
var out = [];
|
||||||
|
var my = {
|
||||||
|
'editor' : editor,
|
||||||
|
'session' : editor.session,
|
||||||
|
'renderer' : editor.renderer
|
||||||
|
};
|
||||||
|
var opts = [];
|
||||||
|
var skip = [
|
||||||
|
'setOption',
|
||||||
|
'setUndoManager',
|
||||||
|
'setDocument',
|
||||||
|
'setValue',
|
||||||
|
'setBreakpoints',
|
||||||
|
'setScrollTop',
|
||||||
|
'setScrollLeft',
|
||||||
|
'setSelectionStyle',
|
||||||
|
'setWrapLimitRange'
|
||||||
|
];
|
||||||
|
['renderer', 'session', 'editor'].forEach(function(esra) {
|
||||||
|
var esr = my[esra];
|
||||||
|
var clss = esra;
|
||||||
|
for(var fn in esr) {
|
||||||
|
if(skip.indexOf(fn) === -1) {
|
||||||
|
if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
|
||||||
|
opts.push(fn);
|
||||||
|
out.push({
|
||||||
|
'functionName' : fn,
|
||||||
|
'parentObj' : esr,
|
||||||
|
'parentName' : clss
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var dom = require("../../lib/dom");
|
||||||
|
var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
|
||||||
|
background-color: #F7F7F7;\
|
||||||
|
color: black;\
|
||||||
|
box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
|
||||||
|
padding: 1em 0.5em 2em 1em;\
|
||||||
|
overflow: auto;\
|
||||||
|
position: absolute;\
|
||||||
|
margin: 0;\
|
||||||
|
bottom: 0;\
|
||||||
|
right: 0;\
|
||||||
|
top: 0;\
|
||||||
|
z-index: 9991;\
|
||||||
|
cursor: default;\
|
||||||
|
}\
|
||||||
|
.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
|
||||||
|
box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
|
||||||
|
background-color: rgba(255, 255, 255, 0.6);\
|
||||||
|
color: black;\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuEntry:hover {\
|
||||||
|
background-color: rgba(100, 100, 100, 0.1);\
|
||||||
|
-webkit-transition: all 0.5s;\
|
||||||
|
transition: all 0.3s\
|
||||||
|
}\
|
||||||
|
.ace_closeButton {\
|
||||||
|
background: rgba(245, 146, 146, 0.5);\
|
||||||
|
border: 1px solid #F48A8A;\
|
||||||
|
border-radius: 50%;\
|
||||||
|
padding: 7px;\
|
||||||
|
position: absolute;\
|
||||||
|
right: -8px;\
|
||||||
|
top: -8px;\
|
||||||
|
z-index: 1000;\
|
||||||
|
}\
|
||||||
|
.ace_closeButton{\
|
||||||
|
background: rgba(245, 146, 146, 0.9);\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuKey {\
|
||||||
|
color: darkslateblue;\
|
||||||
|
font-weight: bold;\
|
||||||
|
}\
|
||||||
|
.ace_optionsMenuCommand {\
|
||||||
|
color: darkcyan;\
|
||||||
|
font-weight: normal;\
|
||||||
|
}";
|
||||||
|
dom.importCssString(cssText);
|
||||||
|
module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
|
||||||
|
top = top ? 'top: ' + top + ';' : '';
|
||||||
|
bottom = bottom ? 'bottom: ' + bottom + ';' : '';
|
||||||
|
right = right ? 'right: ' + right + ';' : '';
|
||||||
|
left = left ? 'left: ' + left + ';' : '';
|
||||||
|
|
||||||
|
var closer = document.createElement('div');
|
||||||
|
var contentContainer = document.createElement('div');
|
||||||
|
|
||||||
|
function documentEscListener(e) {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
closer.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closer.style.cssText = 'margin: 0; padding: 0; ' +
|
||||||
|
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
||||||
|
'z-index: 9990; ' +
|
||||||
|
'background-color: rgba(0, 0, 0, 0.3);';
|
||||||
|
closer.addEventListener('click', function() {
|
||||||
|
document.removeEventListener('keydown', documentEscListener);
|
||||||
|
closer.parentNode.removeChild(closer);
|
||||||
|
editor.focus();
|
||||||
|
closer = null;
|
||||||
|
});
|
||||||
|
document.addEventListener('keydown', documentEscListener);
|
||||||
|
|
||||||
|
contentContainer.style.cssText = top + right + bottom + left;
|
||||||
|
contentContainer.addEventListener('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
var wrapper = dom.createElement("div");
|
||||||
|
wrapper.style.position = "relative";
|
||||||
|
|
||||||
|
var closeButton = dom.createElement("div");
|
||||||
|
closeButton.className = "ace_closeButton";
|
||||||
|
closeButton.addEventListener('click', function() {
|
||||||
|
closer.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapper.appendChild(closeButton);
|
||||||
|
contentContainer.appendChild(wrapper);
|
||||||
|
|
||||||
|
contentContainer.appendChild(contentElement);
|
||||||
|
closer.appendChild(contentContainer);
|
||||||
|
document.body.appendChild(closer);
|
||||||
|
editor.blur();
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
68
src/main/webapp/assets/ace/ext-spellcheck.js
Normal file
68
src/main/webapp/assets/ace/ext-spellcheck.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
ace.define('ace/ext/spellcheck', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/editor', 'ace/config'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var event = require("../lib/event");
|
||||||
|
|
||||||
|
exports.contextMenuHandler = function(e){
|
||||||
|
var host = e.target;
|
||||||
|
var text = host.textInput.getElement();
|
||||||
|
if (!host.selection.isEmpty())
|
||||||
|
return;
|
||||||
|
var c = host.getCursorPosition();
|
||||||
|
var r = host.session.getWordRange(c.row, c.column);
|
||||||
|
var w = host.session.getTextRange(r);
|
||||||
|
|
||||||
|
host.session.tokenRe.lastIndex = 0;
|
||||||
|
if (!host.session.tokenRe.test(w))
|
||||||
|
return;
|
||||||
|
var PLACEHOLDER = "\x01\x01";
|
||||||
|
var value = w + " " + PLACEHOLDER;
|
||||||
|
text.value = value;
|
||||||
|
text.setSelectionRange(w.length, w.length + 1);
|
||||||
|
text.setSelectionRange(0, 0);
|
||||||
|
text.setSelectionRange(0, w.length);
|
||||||
|
|
||||||
|
var afterKeydown = false;
|
||||||
|
event.addListener(text, "keydown", function onKeydown() {
|
||||||
|
event.removeListener(text, "keydown", onKeydown);
|
||||||
|
afterKeydown = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
host.textInput.setInputHandler(function(newVal) {
|
||||||
|
console.log(newVal , value, text.selectionStart, text.selectionEnd)
|
||||||
|
if (newVal == value)
|
||||||
|
return '';
|
||||||
|
if (newVal.lastIndexOf(value, 0) === 0)
|
||||||
|
return newVal.slice(value.length);
|
||||||
|
if (newVal.substr(text.selectionEnd) == value)
|
||||||
|
return newVal.slice(0, -value.length);
|
||||||
|
if (newVal.slice(-2) == PLACEHOLDER) {
|
||||||
|
var val = newVal.slice(0, -2);
|
||||||
|
if (val.slice(-1) == " ") {
|
||||||
|
if (afterKeydown)
|
||||||
|
return val.substring(0, text.selectionEnd);
|
||||||
|
val = val.slice(0, -1);
|
||||||
|
host.session.replace(r, val);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newVal;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var Editor = require("../editor").Editor;
|
||||||
|
require("../config").defineOptions(Editor.prototype, "editor", {
|
||||||
|
spellcheck: {
|
||||||
|
set: function(val) {
|
||||||
|
var text = this.textInput.getElement();
|
||||||
|
text.spellcheck = !!val;
|
||||||
|
if (!val)
|
||||||
|
this.removeListener("nativecontextmenu", exports.contextMenuHandler);
|
||||||
|
else
|
||||||
|
this.on("nativecontextmenu", exports.contextMenuHandler);
|
||||||
|
},
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
271
src/main/webapp/assets/ace/ext-split.js
Normal file
271
src/main/webapp/assets/ace/ext-split.js
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/split', ['require', 'exports', 'module' , 'ace/split'], function(require, exports, module) {
|
||||||
|
module.exports = require("../split");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/split', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/editor', 'ace/virtual_renderer', 'ace/edit_session'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("./lib/oop");
|
||||||
|
var lang = require("./lib/lang");
|
||||||
|
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
|
var Editor = require("./editor").Editor;
|
||||||
|
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||||
|
var EditSession = require("./edit_session").EditSession;
|
||||||
|
|
||||||
|
|
||||||
|
var Split = function(container, theme, splits) {
|
||||||
|
this.BELOW = 1;
|
||||||
|
this.BESIDE = 0;
|
||||||
|
|
||||||
|
this.$container = container;
|
||||||
|
this.$theme = theme;
|
||||||
|
this.$splits = 0;
|
||||||
|
this.$editorCSS = "";
|
||||||
|
this.$editors = [];
|
||||||
|
this.$orientation = this.BESIDE;
|
||||||
|
|
||||||
|
this.setSplits(splits || 1);
|
||||||
|
this.$cEditor = this.$editors[0];
|
||||||
|
|
||||||
|
|
||||||
|
this.on("focus", function(editor) {
|
||||||
|
this.$cEditor = editor;
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
|
this.$createEditor = function() {
|
||||||
|
var el = document.createElement("div");
|
||||||
|
el.className = this.$editorCSS;
|
||||||
|
el.style.cssText = "position: absolute; top:0px; bottom:0px";
|
||||||
|
this.$container.appendChild(el);
|
||||||
|
var editor = new Editor(new Renderer(el, this.$theme));
|
||||||
|
|
||||||
|
editor.on("focus", function() {
|
||||||
|
this._emit("focus", editor);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
this.$editors.push(editor);
|
||||||
|
editor.setFontSize(this.$fontSize);
|
||||||
|
return editor;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.setSplits = function(splits) {
|
||||||
|
var editor;
|
||||||
|
if (splits < 1) {
|
||||||
|
throw "The number of splits have to be > 0!";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (splits == this.$splits) {
|
||||||
|
return;
|
||||||
|
} else if (splits > this.$splits) {
|
||||||
|
while (this.$splits < this.$editors.length && this.$splits < splits) {
|
||||||
|
editor = this.$editors[this.$splits];
|
||||||
|
this.$container.appendChild(editor.container);
|
||||||
|
editor.setFontSize(this.$fontSize);
|
||||||
|
this.$splits ++;
|
||||||
|
}
|
||||||
|
while (this.$splits < splits) {
|
||||||
|
this.$createEditor();
|
||||||
|
this.$splits ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (this.$splits > splits) {
|
||||||
|
editor = this.$editors[this.$splits - 1];
|
||||||
|
this.$container.removeChild(editor.container);
|
||||||
|
this.$splits --;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.resize();
|
||||||
|
};
|
||||||
|
this.getSplits = function() {
|
||||||
|
return this.$splits;
|
||||||
|
};
|
||||||
|
this.getEditor = function(idx) {
|
||||||
|
return this.$editors[idx];
|
||||||
|
};
|
||||||
|
this.getCurrentEditor = function() {
|
||||||
|
return this.$cEditor;
|
||||||
|
};
|
||||||
|
this.focus = function() {
|
||||||
|
this.$cEditor.focus();
|
||||||
|
};
|
||||||
|
this.blur = function() {
|
||||||
|
this.$cEditor.blur();
|
||||||
|
};
|
||||||
|
this.setTheme = function(theme) {
|
||||||
|
this.$editors.forEach(function(editor) {
|
||||||
|
editor.setTheme(theme);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
this.setKeyboardHandler = function(keybinding) {
|
||||||
|
this.$editors.forEach(function(editor) {
|
||||||
|
editor.setKeyboardHandler(keybinding);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
this.forEach = function(callback, scope) {
|
||||||
|
this.$editors.forEach(callback, scope);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.$fontSize = "";
|
||||||
|
this.setFontSize = function(size) {
|
||||||
|
this.$fontSize = size;
|
||||||
|
this.forEach(function(editor) {
|
||||||
|
editor.setFontSize(size);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$cloneSession = function(session) {
|
||||||
|
var s = new EditSession(session.getDocument(), session.getMode());
|
||||||
|
|
||||||
|
var undoManager = session.getUndoManager();
|
||||||
|
if (undoManager) {
|
||||||
|
var undoManagerProxy = new UndoManagerProxy(undoManager, s);
|
||||||
|
s.setUndoManager(undoManagerProxy);
|
||||||
|
}
|
||||||
|
s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
|
||||||
|
s.setTabSize(session.getTabSize());
|
||||||
|
s.setUseSoftTabs(session.getUseSoftTabs());
|
||||||
|
s.setOverwrite(session.getOverwrite());
|
||||||
|
s.setBreakpoints(session.getBreakpoints());
|
||||||
|
s.setUseWrapMode(session.getUseWrapMode());
|
||||||
|
s.setUseWorker(session.getUseWorker());
|
||||||
|
s.setWrapLimitRange(session.$wrapLimitRange.min,
|
||||||
|
session.$wrapLimitRange.max);
|
||||||
|
s.$foldData = session.$cloneFoldData();
|
||||||
|
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
this.setSession = function(session, idx) {
|
||||||
|
var editor;
|
||||||
|
if (idx == null) {
|
||||||
|
editor = this.$cEditor;
|
||||||
|
} else {
|
||||||
|
editor = this.$editors[idx];
|
||||||
|
}
|
||||||
|
var isUsed = this.$editors.some(function(editor) {
|
||||||
|
return editor.session === session;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isUsed) {
|
||||||
|
session = this.$cloneSession(session);
|
||||||
|
}
|
||||||
|
editor.setSession(session);
|
||||||
|
return session;
|
||||||
|
};
|
||||||
|
this.getOrientation = function() {
|
||||||
|
return this.$orientation;
|
||||||
|
};
|
||||||
|
this.setOrientation = function(orientation) {
|
||||||
|
if (this.$orientation == orientation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$orientation = orientation;
|
||||||
|
this.resize();
|
||||||
|
};
|
||||||
|
this.resize = function() {
|
||||||
|
var width = this.$container.clientWidth;
|
||||||
|
var height = this.$container.clientHeight;
|
||||||
|
var editor;
|
||||||
|
|
||||||
|
if (this.$orientation == this.BESIDE) {
|
||||||
|
var editorWidth = width / this.$splits;
|
||||||
|
for (var i = 0; i < this.$splits; i++) {
|
||||||
|
editor = this.$editors[i];
|
||||||
|
editor.container.style.width = editorWidth + "px";
|
||||||
|
editor.container.style.top = "0px";
|
||||||
|
editor.container.style.left = i * editorWidth + "px";
|
||||||
|
editor.container.style.height = height + "px";
|
||||||
|
editor.resize();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var editorHeight = height / this.$splits;
|
||||||
|
for (var i = 0; i < this.$splits; i++) {
|
||||||
|
editor = this.$editors[i];
|
||||||
|
editor.container.style.width = width + "px";
|
||||||
|
editor.container.style.top = i * editorHeight + "px";
|
||||||
|
editor.container.style.left = "0px";
|
||||||
|
editor.container.style.height = editorHeight + "px";
|
||||||
|
editor.resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(Split.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
function UndoManagerProxy(undoManager, session) {
|
||||||
|
this.$u = undoManager;
|
||||||
|
this.$doc = session;
|
||||||
|
}
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.execute = function(options) {
|
||||||
|
this.$u.execute(options);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.undo = function() {
|
||||||
|
var selectionRange = this.$u.undo(true);
|
||||||
|
if (selectionRange) {
|
||||||
|
this.$doc.selection.setSelectionRange(selectionRange);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.redo = function() {
|
||||||
|
var selectionRange = this.$u.redo(true);
|
||||||
|
if (selectionRange) {
|
||||||
|
this.$doc.selection.setSelectionRange(selectionRange);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.reset = function() {
|
||||||
|
this.$u.reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hasUndo = function() {
|
||||||
|
return this.$u.hasUndo();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hasRedo = function() {
|
||||||
|
return this.$u.hasRedo();
|
||||||
|
};
|
||||||
|
}).call(UndoManagerProxy.prototype);
|
||||||
|
|
||||||
|
exports.Split = Split;
|
||||||
|
});
|
||||||
178
src/main/webapp/assets/ace/ext-static_highlight.js
Normal file
178
src/main/webapp/assets/ace/ext-static_highlight.js
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/static_highlight', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/layer/text', 'ace/config', 'ace/lib/dom'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var EditSession = require("../edit_session").EditSession;
|
||||||
|
var TextLayer = require("../layer/text").Text;
|
||||||
|
var baseStyles = ".ace_static_highlight {\
|
||||||
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\
|
||||||
|
font-size: 12px;\
|
||||||
|
}\
|
||||||
|
.ace_static_highlight .ace_gutter {\
|
||||||
|
width: 25px !important;\
|
||||||
|
display: block;\
|
||||||
|
float: left;\
|
||||||
|
text-align: right;\
|
||||||
|
padding: 0 3px 0 0;\
|
||||||
|
margin-right: 3px;\
|
||||||
|
position: static !important;\
|
||||||
|
}\
|
||||||
|
.ace_static_highlight .ace_line { clear: both; }\
|
||||||
|
.ace_static_highlight .ace_gutter-cell {\
|
||||||
|
-moz-user-select: -moz-none;\
|
||||||
|
-khtml-user-select: none;\
|
||||||
|
-webkit-user-select: none;\
|
||||||
|
user-select: none;\
|
||||||
|
}\
|
||||||
|
.ace_static_highlight .ace_gutter-cell:before {\
|
||||||
|
content: counter(ace_line, decimal);\
|
||||||
|
counter-increment: ace_line;\
|
||||||
|
}\
|
||||||
|
.ace_static_highlight {\
|
||||||
|
counter-reset: ace_line;\
|
||||||
|
}\
|
||||||
|
";
|
||||||
|
var config = require("../config");
|
||||||
|
var dom = require("../lib/dom");
|
||||||
|
|
||||||
|
|
||||||
|
var highlight = function(el, opts, callback) {
|
||||||
|
var m = el.className.match(/lang-(\w+)/);
|
||||||
|
var mode = opts.mode || m && ("ace/mode/" + m[1]);
|
||||||
|
if (!mode)
|
||||||
|
return false;
|
||||||
|
var theme = opts.theme || "ace/theme/textmate";
|
||||||
|
|
||||||
|
var data = "";
|
||||||
|
var nodes = [];
|
||||||
|
|
||||||
|
if (el.firstElementChild) {
|
||||||
|
var textLen = 0;
|
||||||
|
for (var i = 0; i < el.childNodes.length; i++) {
|
||||||
|
var ch = el.childNodes[i];
|
||||||
|
if (ch.nodeType == 3) {
|
||||||
|
textLen += ch.data.length;
|
||||||
|
data += ch.data;
|
||||||
|
} else {
|
||||||
|
nodes.push(textLen, ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data = dom.getInnerText(el);
|
||||||
|
if (opts.trim)
|
||||||
|
data = data.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
|
||||||
|
dom.importCssString(highlighted.css, "ace_highlight");
|
||||||
|
el.innerHTML = highlighted.html;
|
||||||
|
var container = el.firstChild.firstChild;
|
||||||
|
for (var i = 0; i < nodes.length; i += 2) {
|
||||||
|
var pos = highlighted.session.doc.indexToPosition(nodes[i]);
|
||||||
|
var node = nodes[i + 1];
|
||||||
|
var lineEl = container.children[pos.row];
|
||||||
|
lineEl && lineEl.appendChild(node);
|
||||||
|
}
|
||||||
|
callback && callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
|
||||||
|
var waiting = 0;
|
||||||
|
var modeCache = EditSession.prototype.$modes;
|
||||||
|
if (typeof theme == "string") {
|
||||||
|
waiting++;
|
||||||
|
config.loadModule(['theme', theme], function(m) {
|
||||||
|
theme = m;
|
||||||
|
--waiting || done();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof mode == "string") {
|
||||||
|
waiting++;
|
||||||
|
config.loadModule(['mode', mode], function(m) {
|
||||||
|
if (!modeCache[mode]) modeCache[mode] = new m.Mode();
|
||||||
|
mode = modeCache[mode];
|
||||||
|
--waiting || done();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function done() {
|
||||||
|
var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
|
||||||
|
return callback ? callback(result) : result;
|
||||||
|
}
|
||||||
|
return waiting || done();
|
||||||
|
};
|
||||||
|
|
||||||
|
highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
|
||||||
|
lineStart = parseInt(lineStart || 1, 10);
|
||||||
|
|
||||||
|
var session = new EditSession("");
|
||||||
|
session.setUseWorker(false);
|
||||||
|
session.setMode(mode);
|
||||||
|
|
||||||
|
var textLayer = new TextLayer(document.createElement("div"));
|
||||||
|
textLayer.setSession(session);
|
||||||
|
textLayer.config = {
|
||||||
|
characterWidth: 10,
|
||||||
|
lineHeight: 20
|
||||||
|
};
|
||||||
|
|
||||||
|
session.setValue(input);
|
||||||
|
|
||||||
|
var stringBuilder = [];
|
||||||
|
var length = session.getLength();
|
||||||
|
|
||||||
|
for(var ix = 0; ix < length; ix++) {
|
||||||
|
stringBuilder.push("<div class='ace_line'>");
|
||||||
|
if (!disableGutter)
|
||||||
|
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + /*(ix + lineStart) + */ "</span>");
|
||||||
|
textLayer.$renderLine(stringBuilder, ix, true, false);
|
||||||
|
stringBuilder.push("\n</div>");
|
||||||
|
}
|
||||||
|
var html = "<div class='" + theme.cssClass + "'>" +
|
||||||
|
"<div class='ace_static_highlight' style='counter-reset:ace_line " + (lineStart - 1) + "'>" +
|
||||||
|
stringBuilder.join("") +
|
||||||
|
"</div>" +
|
||||||
|
"</div>";
|
||||||
|
|
||||||
|
textLayer.destroy();
|
||||||
|
|
||||||
|
return {
|
||||||
|
css: baseStyles + theme.cssText,
|
||||||
|
html: html,
|
||||||
|
session: session
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = highlight;
|
||||||
|
module.exports.highlight =highlight;
|
||||||
|
});
|
||||||
47
src/main/webapp/assets/ace/ext-statusbar.js
Normal file
47
src/main/webapp/assets/ace/ext-statusbar.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
ace.define('ace/ext/statusbar', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
var dom = require("ace/lib/dom");
|
||||||
|
var lang = require("ace/lib/lang");
|
||||||
|
|
||||||
|
var StatusBar = function(editor, parentNode) {
|
||||||
|
this.element = dom.createElement("div");
|
||||||
|
this.element.className = "ace_status-indicator";
|
||||||
|
this.element.style.cssText = "display: inline-block;";
|
||||||
|
parentNode.appendChild(this.element);
|
||||||
|
|
||||||
|
var statusUpdate = lang.delayedCall(function(){
|
||||||
|
this.updateStatus(editor)
|
||||||
|
}.bind(this));
|
||||||
|
editor.on("changeStatus", function() {
|
||||||
|
statusUpdate.schedule(100);
|
||||||
|
});
|
||||||
|
editor.on("changeSelection", function() {
|
||||||
|
statusUpdate.schedule(100);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
this.updateStatus = function(editor) {
|
||||||
|
var status = [];
|
||||||
|
function add(str, separator) {
|
||||||
|
str && status.push(str, separator || "|");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editor.$vimModeHandler)
|
||||||
|
add(editor.$vimModeHandler.getStatusText());
|
||||||
|
else if (editor.commands.recording)
|
||||||
|
add("REC");
|
||||||
|
|
||||||
|
var c = editor.selection.lead;
|
||||||
|
add(c.row + ":" + c.column, " ");
|
||||||
|
if (!editor.selection.isEmpty()) {
|
||||||
|
var r = editor.getSelectionRange();
|
||||||
|
add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
|
||||||
|
}
|
||||||
|
status.pop();
|
||||||
|
this.element.textContent = status.join("");
|
||||||
|
};
|
||||||
|
}).call(StatusBar.prototype);
|
||||||
|
|
||||||
|
exports.StatusBar = StatusBar;
|
||||||
|
|
||||||
|
});
|
||||||
478
src/main/webapp/assets/ace/ext-textarea.js
Normal file
478
src/main/webapp/assets/ace/ext-textarea.js
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/textarea', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/lib/net', 'ace/ace', 'ace/theme/textmate', 'ace/mode/text'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var event = require("../lib/event");
|
||||||
|
var UA = require("../lib/useragent");
|
||||||
|
var net = require("../lib/net");
|
||||||
|
var ace = require("../ace");
|
||||||
|
|
||||||
|
require("../theme/textmate");
|
||||||
|
|
||||||
|
module.exports = exports = ace;
|
||||||
|
var getCSSProperty = function(element, container, property) {
|
||||||
|
var ret = element.style[property];
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
if (window.getComputedStyle) {
|
||||||
|
ret = window.getComputedStyle(element, '').getPropertyValue(property);
|
||||||
|
} else {
|
||||||
|
ret = element.currentStyle[property];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret || ret == 'auto' || ret == 'intrinsic') {
|
||||||
|
ret = container.style[property];
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
function applyStyles(elm, styles) {
|
||||||
|
for (var style in styles) {
|
||||||
|
elm.style[style] = styles[style];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupContainer(element, getValue) {
|
||||||
|
if (element.type != 'textarea') {
|
||||||
|
throw new Error("Textarea required!");
|
||||||
|
}
|
||||||
|
|
||||||
|
var parentNode = element.parentNode;
|
||||||
|
var container = document.createElement('div');
|
||||||
|
var resizeEvent = function() {
|
||||||
|
var style = 'position:relative;';
|
||||||
|
[
|
||||||
|
'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
|
||||||
|
].forEach(function(item) {
|
||||||
|
style += item + ':' +
|
||||||
|
getCSSProperty(element, container, item) + ';';
|
||||||
|
});
|
||||||
|
var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
|
||||||
|
var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
|
||||||
|
style += 'height:' + height + ';width:' + width + ';';
|
||||||
|
style += 'display:inline-block;';
|
||||||
|
container.setAttribute('style', style);
|
||||||
|
};
|
||||||
|
event.addListener(window, 'resize', resizeEvent);
|
||||||
|
resizeEvent();
|
||||||
|
parentNode.insertBefore(container, element.nextSibling);
|
||||||
|
while (parentNode !== document) {
|
||||||
|
if (parentNode.tagName.toUpperCase() === 'FORM') {
|
||||||
|
var oldSumit = parentNode.onsubmit;
|
||||||
|
parentNode.onsubmit = function(evt) {
|
||||||
|
element.value = getValue();
|
||||||
|
if (oldSumit) {
|
||||||
|
oldSumit.call(this, evt);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parentNode = parentNode.parentNode;
|
||||||
|
}
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.transformTextarea = function(element, loader) {
|
||||||
|
var session;
|
||||||
|
var container = setupContainer(element, function() {
|
||||||
|
return session.getValue();
|
||||||
|
});
|
||||||
|
element.style.display = 'none';
|
||||||
|
container.style.background = 'white';
|
||||||
|
var editorDiv = document.createElement("div");
|
||||||
|
applyStyles(editorDiv, {
|
||||||
|
top: "0px",
|
||||||
|
left: "0px",
|
||||||
|
right: "0px",
|
||||||
|
bottom: "0px",
|
||||||
|
border: "1px solid gray",
|
||||||
|
position: "absolute"
|
||||||
|
});
|
||||||
|
container.appendChild(editorDiv);
|
||||||
|
|
||||||
|
var settingOpener = document.createElement("div");
|
||||||
|
applyStyles(settingOpener, {
|
||||||
|
position: "absolute",
|
||||||
|
right: "0px",
|
||||||
|
bottom: "0px",
|
||||||
|
background: "red",
|
||||||
|
cursor: "nw-resize",
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderWidth: "9px 8px 10px 9px",
|
||||||
|
width: "2px",
|
||||||
|
borderColor: "lightblue gray gray lightblue",
|
||||||
|
zIndex: 101
|
||||||
|
});
|
||||||
|
|
||||||
|
var settingDiv = document.createElement("div");
|
||||||
|
var settingDivStyles = {
|
||||||
|
top: "0px",
|
||||||
|
left: "20%",
|
||||||
|
right: "0px",
|
||||||
|
bottom: "0px",
|
||||||
|
position: "absolute",
|
||||||
|
padding: "5px",
|
||||||
|
zIndex: 100,
|
||||||
|
color: "white",
|
||||||
|
display: "none",
|
||||||
|
overflow: "auto",
|
||||||
|
fontSize: "14px",
|
||||||
|
boxShadow: "-5px 2px 3px gray"
|
||||||
|
};
|
||||||
|
if (!UA.isOldIE) {
|
||||||
|
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
|
||||||
|
} else {
|
||||||
|
settingDivStyles.backgroundColor = "#333";
|
||||||
|
}
|
||||||
|
|
||||||
|
applyStyles(settingDiv, settingDivStyles);
|
||||||
|
container.appendChild(settingDiv);
|
||||||
|
var options = {};
|
||||||
|
|
||||||
|
var editor = ace.edit(editorDiv);
|
||||||
|
session = editor.getSession();
|
||||||
|
|
||||||
|
session.setValue(element.value || element.innerHTML);
|
||||||
|
editor.focus();
|
||||||
|
container.appendChild(settingOpener);
|
||||||
|
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
|
||||||
|
setupSettingPanel(settingDiv, settingOpener, editor, options);
|
||||||
|
|
||||||
|
var state = "";
|
||||||
|
event.addListener(settingOpener, "mousemove", function(e) {
|
||||||
|
var rect = this.getBoundingClientRect();
|
||||||
|
var x = e.clientX - rect.left, y = e.clientY - rect.top;
|
||||||
|
if (x + y < (rect.width + rect.height)/2) {
|
||||||
|
this.style.cursor = "pointer";
|
||||||
|
state = "toggle";
|
||||||
|
} else {
|
||||||
|
state = "resize";
|
||||||
|
this.style.cursor = "nw-resize";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
event.addListener(settingOpener, "mousedown", function(e) {
|
||||||
|
if (state == "toggle") {
|
||||||
|
editor.setDisplaySettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
container.style.zIndex = 100000;
|
||||||
|
var rect = container.getBoundingClientRect();
|
||||||
|
var startX = rect.width + rect.left - e.clientX;
|
||||||
|
var startY = rect.height + rect.top - e.clientY;
|
||||||
|
event.capture(settingOpener, function(e) {
|
||||||
|
container.style.width = e.clientX - rect.left + startX + "px";
|
||||||
|
container.style.height = e.clientY - rect.top + startY + "px";
|
||||||
|
editor.resize();
|
||||||
|
}, function() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
return editor;
|
||||||
|
};
|
||||||
|
|
||||||
|
function load(url, module, callback) {
|
||||||
|
net.loadScript(url, function() {
|
||||||
|
require([module], callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
|
||||||
|
var session = editor.getSession();
|
||||||
|
var renderer = editor.renderer;
|
||||||
|
loader = loader || load;
|
||||||
|
|
||||||
|
function toBool(value) {
|
||||||
|
return value === "true" || value == true;
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.setDisplaySettings = function(display) {
|
||||||
|
if (display == null)
|
||||||
|
display = settingDiv.style.display == "none";
|
||||||
|
if (display) {
|
||||||
|
settingDiv.style.display = "block";
|
||||||
|
settingDiv.hideButton.focus();
|
||||||
|
editor.on("focus", function onFocus() {
|
||||||
|
editor.removeListener("focus", onFocus);
|
||||||
|
settingDiv.style.display = "none";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
editor.focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.$setOption = editor.setOption;
|
||||||
|
editor.setOption = function(key, value) {
|
||||||
|
if (options[key] == value) return;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case "mode":
|
||||||
|
if (value != "text") {
|
||||||
|
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
|
||||||
|
var aceMode = require("../mode/" + value).Mode;
|
||||||
|
session.setMode(new aceMode());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
session.setMode(new (require("../mode/text").Mode));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "theme":
|
||||||
|
if (value != "textmate") {
|
||||||
|
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
|
||||||
|
editor.setTheme("ace/theme/" + value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
editor.setTheme("ace/theme/textmate");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "fontSize":
|
||||||
|
editorDiv.style.fontSize = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "keybindings":
|
||||||
|
switch (value) {
|
||||||
|
case "vim":
|
||||||
|
editor.setKeyboardHandler("ace/keyboard/vim");
|
||||||
|
break;
|
||||||
|
case "emacs":
|
||||||
|
editor.setKeyboardHandler("ace/keyboard/emacs");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
editor.setKeyboardHandler(null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "softWrap":
|
||||||
|
switch (value) {
|
||||||
|
case "off":
|
||||||
|
session.setUseWrapMode(false);
|
||||||
|
renderer.setPrintMarginColumn(80);
|
||||||
|
break;
|
||||||
|
case "40":
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setWrapLimitRange(40, 40);
|
||||||
|
renderer.setPrintMarginColumn(40);
|
||||||
|
break;
|
||||||
|
case "80":
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setWrapLimitRange(80, 80);
|
||||||
|
renderer.setPrintMarginColumn(80);
|
||||||
|
break;
|
||||||
|
case "free":
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setWrapLimitRange(null, null);
|
||||||
|
renderer.setPrintMarginColumn(80);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
editor.$setOption(key, toBool(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
options[key] = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.getOption = function(key) {
|
||||||
|
return options[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.getOptions = function() {
|
||||||
|
return options;
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.setOptions(exports.options);
|
||||||
|
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||||
|
var BOOL = null;
|
||||||
|
|
||||||
|
var desc = {
|
||||||
|
mode: "Mode:",
|
||||||
|
gutter: "Display Gutter:",
|
||||||
|
theme: "Theme:",
|
||||||
|
fontSize: "Font Size:",
|
||||||
|
softWrap: "Soft Wrap:",
|
||||||
|
keybindings: "Keyboard",
|
||||||
|
showPrintMargin: "Show Print Margin:",
|
||||||
|
useSoftTabs: "Use Soft Tabs:",
|
||||||
|
showInvisibles: "Show Invisibles"
|
||||||
|
};
|
||||||
|
|
||||||
|
var optionValues = {
|
||||||
|
mode: {
|
||||||
|
text: "Plain",
|
||||||
|
javascript: "JavaScript",
|
||||||
|
xml: "XML",
|
||||||
|
html: "HTML",
|
||||||
|
css: "CSS",
|
||||||
|
scss: "SCSS",
|
||||||
|
python: "Python",
|
||||||
|
php: "PHP",
|
||||||
|
java: "Java",
|
||||||
|
ruby: "Ruby",
|
||||||
|
c_cpp: "C/C++",
|
||||||
|
coffee: "CoffeeScript",
|
||||||
|
json: "json",
|
||||||
|
perl: "Perl",
|
||||||
|
clojure: "Clojure",
|
||||||
|
ocaml: "OCaml",
|
||||||
|
csharp: "C#",
|
||||||
|
haxe: "haXe",
|
||||||
|
svg: "SVG",
|
||||||
|
textile: "Textile",
|
||||||
|
groovy: "Groovy",
|
||||||
|
liquid: "Liquid",
|
||||||
|
Scala: "Scala"
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
clouds: "Clouds",
|
||||||
|
clouds_midnight: "Clouds Midnight",
|
||||||
|
cobalt: "Cobalt",
|
||||||
|
crimson_editor: "Crimson Editor",
|
||||||
|
dawn: "Dawn",
|
||||||
|
eclipse: "Eclipse",
|
||||||
|
idle_fingers: "Idle Fingers",
|
||||||
|
kr_theme: "Kr Theme",
|
||||||
|
merbivore: "Merbivore",
|
||||||
|
merbivore_soft: "Merbivore Soft",
|
||||||
|
mono_industrial: "Mono Industrial",
|
||||||
|
monokai: "Monokai",
|
||||||
|
pastel_on_dark: "Pastel On Dark",
|
||||||
|
solarized_dark: "Solarized Dark",
|
||||||
|
solarized_light: "Solarized Light",
|
||||||
|
textmate: "Textmate",
|
||||||
|
twilight: "Twilight",
|
||||||
|
vibrant_ink: "Vibrant Ink"
|
||||||
|
},
|
||||||
|
gutter: BOOL,
|
||||||
|
fontSize: {
|
||||||
|
"10px": "10px",
|
||||||
|
"11px": "11px",
|
||||||
|
"12px": "12px",
|
||||||
|
"14px": "14px",
|
||||||
|
"16px": "16px"
|
||||||
|
},
|
||||||
|
softWrap: {
|
||||||
|
off: "Off",
|
||||||
|
40: "40",
|
||||||
|
80: "80",
|
||||||
|
free: "Free"
|
||||||
|
},
|
||||||
|
keybindings: {
|
||||||
|
ace: "ace",
|
||||||
|
vim: "vim",
|
||||||
|
emacs: "emacs"
|
||||||
|
},
|
||||||
|
showPrintMargin: BOOL,
|
||||||
|
useSoftTabs: BOOL,
|
||||||
|
showInvisibles: BOOL
|
||||||
|
};
|
||||||
|
|
||||||
|
var table = [];
|
||||||
|
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
|
||||||
|
|
||||||
|
function renderOption(builder, option, obj, cValue) {
|
||||||
|
if (!obj) {
|
||||||
|
builder.push(
|
||||||
|
"<input type='checkbox' title='", option, "' ",
|
||||||
|
cValue == "true" ? "checked='true'" : "",
|
||||||
|
"'></input>"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
builder.push("<select title='" + option + "'>");
|
||||||
|
for (var value in obj) {
|
||||||
|
builder.push("<option value='" + value + "' ");
|
||||||
|
|
||||||
|
if (cValue == value) {
|
||||||
|
builder.push(" selected ");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.push(">",
|
||||||
|
obj[value],
|
||||||
|
"</option>");
|
||||||
|
}
|
||||||
|
builder.push("</select>");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var option in options) {
|
||||||
|
table.push("<tr><td>", desc[option], "</td>");
|
||||||
|
table.push("<td>");
|
||||||
|
renderOption(table, option, optionValues[option], options[option]);
|
||||||
|
table.push("</td></tr>");
|
||||||
|
}
|
||||||
|
table.push("</table>");
|
||||||
|
settingDiv.innerHTML = table.join("");
|
||||||
|
|
||||||
|
var onChange = function(e) {
|
||||||
|
var select = e.currentTarget;
|
||||||
|
editor.setOption(select.title, select.value);
|
||||||
|
};
|
||||||
|
var onClick = function(e) {
|
||||||
|
var cb = e.currentTarget;
|
||||||
|
editor.setOption(cb.title, cb.checked);
|
||||||
|
};
|
||||||
|
var selects = settingDiv.getElementsByTagName("select");
|
||||||
|
for (var i = 0; i < selects.length; i++)
|
||||||
|
selects[i].onchange = onChange;
|
||||||
|
var cbs = settingDiv.getElementsByTagName("input");
|
||||||
|
for (var i = 0; i < cbs.length; i++)
|
||||||
|
cbs[i].onclick = onClick;
|
||||||
|
|
||||||
|
|
||||||
|
var button = document.createElement("input");
|
||||||
|
button.type = "button";
|
||||||
|
button.value = "Hide";
|
||||||
|
event.addListener(button, "click", function() {
|
||||||
|
editor.setDisplaySettings(false);
|
||||||
|
});
|
||||||
|
settingDiv.appendChild(button);
|
||||||
|
settingDiv.hideButton = button;
|
||||||
|
}
|
||||||
|
exports.options = {
|
||||||
|
mode: "text",
|
||||||
|
theme: "textmate",
|
||||||
|
gutter: "false",
|
||||||
|
fontSize: "12px",
|
||||||
|
softWrap: "off",
|
||||||
|
keybindings: "ace",
|
||||||
|
showPrintMargin: "false",
|
||||||
|
useSoftTabs: "true",
|
||||||
|
showInvisibles: "false"
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
87
src/main/webapp/assets/ace/ext-themelist.js
Normal file
87
src/main/webapp/assets/ace/ext-themelist.js
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Contributed to Ajax.org under the BSD license.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers'], function(require, exports, module) {
|
||||||
|
|
||||||
|
require("ace/lib/fixoldbrowsers");
|
||||||
|
|
||||||
|
var themeData = [
|
||||||
|
["Chrome" ],
|
||||||
|
["Clouds" ],
|
||||||
|
["Crimson Editor" ],
|
||||||
|
["Dawn" ],
|
||||||
|
["Dreamweaver" ],
|
||||||
|
["Eclipse" ],
|
||||||
|
["GitHub" ],
|
||||||
|
["Solarized Light"],
|
||||||
|
["TextMate" ],
|
||||||
|
["Tomorrow" ],
|
||||||
|
["XCode" ],
|
||||||
|
["Kuroir"],
|
||||||
|
["KatzenMilch"],
|
||||||
|
["Ambiance" ,"ambiance" , "dark"],
|
||||||
|
["Chaos" ,"chaos" , "dark"],
|
||||||
|
["Clouds Midnight" ,"clouds_midnight" , "dark"],
|
||||||
|
["Cobalt" ,"cobalt" , "dark"],
|
||||||
|
["idle Fingers" ,"idle_fingers" , "dark"],
|
||||||
|
["krTheme" ,"kr_theme" , "dark"],
|
||||||
|
["Merbivore" ,"merbivore" , "dark"],
|
||||||
|
["Merbivore Soft" ,"merbivore_soft" , "dark"],
|
||||||
|
["Mono Industrial" ,"mono_industrial" , "dark"],
|
||||||
|
["Monokai" ,"monokai" , "dark"],
|
||||||
|
["Pastel on dark" ,"pastel_on_dark" , "dark"],
|
||||||
|
["Solarized Dark" ,"solarized_dark" , "dark"],
|
||||||
|
["Terminal" ,"terminal" , "dark"],
|
||||||
|
["Tomorrow Night" ,"tomorrow_night" , "dark"],
|
||||||
|
["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
|
||||||
|
["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
|
||||||
|
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
|
||||||
|
["Twilight" ,"twilight" , "dark"],
|
||||||
|
["Vibrant Ink" ,"vibrant_ink" , "dark"]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
exports.themesByName = {};
|
||||||
|
exports.themes = themeData.map(function(data) {
|
||||||
|
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
|
||||||
|
var theme = {
|
||||||
|
caption: data[0],
|
||||||
|
theme: "ace/theme/" + name,
|
||||||
|
isDark: data[2] == "dark",
|
||||||
|
name: name
|
||||||
|
};
|
||||||
|
exports.themesByName[name] = theme;
|
||||||
|
return theme;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
209
src/main/webapp/assets/ace/ext-whitespace.js
Normal file
209
src/main/webapp/assets/ace/ext-whitespace.js
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/ext/whitespace', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
exports.$detectIndentation = function(lines, fallback) {
|
||||||
|
var stats = [];
|
||||||
|
var changes = [];
|
||||||
|
var tabIndents = 0;
|
||||||
|
var prevSpaces = 0;
|
||||||
|
var max = Math.min(lines.length, 1000);
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
var line = lines[i];
|
||||||
|
if (!/^\s*[^*+\-\s]/.test(line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var tabs = line.match(/^\t*/)[0].length;
|
||||||
|
if (line[0] == "\t")
|
||||||
|
tabIndents++;
|
||||||
|
|
||||||
|
var spaces = line.match(/^ */)[0].length;
|
||||||
|
if (spaces && line[spaces] != "\t") {
|
||||||
|
var diff = spaces - prevSpaces;
|
||||||
|
if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
|
||||||
|
changes[diff] = (changes[diff] || 0) + 1;
|
||||||
|
|
||||||
|
stats[spaces] = (stats[spaces] || 0) + 1;
|
||||||
|
}
|
||||||
|
prevSpaces = spaces;
|
||||||
|
while (i < max && line[line.length - 1] == "\\")
|
||||||
|
line = lines[i++];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stats.length)
|
||||||
|
return;
|
||||||
|
|
||||||
|
function getScore(indent) {
|
||||||
|
var score = 0;
|
||||||
|
for (var i = indent; i < stats.length; i += indent)
|
||||||
|
score += stats[i] || 0;
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
|
||||||
|
|
||||||
|
var first = {score: 0, length: 0};
|
||||||
|
var spaceIndents = 0;
|
||||||
|
for (var i = 1; i < 12; i++) {
|
||||||
|
if (i == 1) {
|
||||||
|
spaceIndents = getScore(i);
|
||||||
|
var score = 1;
|
||||||
|
} else
|
||||||
|
var score = getScore(i) / spaceIndents;
|
||||||
|
|
||||||
|
if (changes[i]) {
|
||||||
|
score += changes[i] / changesTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (score > first.score)
|
||||||
|
first = {score: score, length: i};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (first.score && first.score > 1.4)
|
||||||
|
var tabLength = first.length;
|
||||||
|
|
||||||
|
if (tabIndents > spaceIndents + 1)
|
||||||
|
return {ch: "\t", length: tabLength};
|
||||||
|
|
||||||
|
if (spaceIndents + 1 > tabIndents)
|
||||||
|
return {ch: " ", length: tabLength};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.detectIndentation = function(session) {
|
||||||
|
var lines = session.getLines(0, 1000);
|
||||||
|
var indent = exports.$detectIndentation(lines) || {};
|
||||||
|
|
||||||
|
if (indent.ch)
|
||||||
|
session.setUseSoftTabs(indent.ch == " ");
|
||||||
|
|
||||||
|
if (indent.length)
|
||||||
|
session.setTabSize(indent.length);
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.trimTrailingSpace = function(session, trimEmpty) {
|
||||||
|
var doc = session.getDocument();
|
||||||
|
var lines = doc.getAllLines();
|
||||||
|
|
||||||
|
var min = trimEmpty ? -1 : 0;
|
||||||
|
|
||||||
|
for (var i = 0, l=lines.length; i < l; i++) {
|
||||||
|
var line = lines[i];
|
||||||
|
var index = line.search(/\s+$/);
|
||||||
|
|
||||||
|
if (index > min)
|
||||||
|
doc.removeInLine(i, index, line.length);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.convertIndentation = function(session, ch, len) {
|
||||||
|
var oldCh = session.getTabString()[0];
|
||||||
|
var oldLen = session.getTabSize();
|
||||||
|
if (!len) len = oldLen;
|
||||||
|
if (!ch) ch = oldCh;
|
||||||
|
|
||||||
|
var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
|
||||||
|
|
||||||
|
var doc = session.doc;
|
||||||
|
var lines = doc.getAllLines();
|
||||||
|
|
||||||
|
var cache = {};
|
||||||
|
var spaceCache = {};
|
||||||
|
for (var i = 0, l=lines.length; i < l; i++) {
|
||||||
|
var line = lines[i];
|
||||||
|
var match = line.match(/^\s*/)[0];
|
||||||
|
if (match) {
|
||||||
|
var w = session.$getStringScreenWidth(match)[0];
|
||||||
|
var tabCount = Math.floor(w/oldLen);
|
||||||
|
var reminder = w%oldLen;
|
||||||
|
var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
|
||||||
|
toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
|
||||||
|
|
||||||
|
if (toInsert != match) {
|
||||||
|
doc.removeInLine(i, 0, match.length);
|
||||||
|
doc.insertInLine({row: i, column: 0}, toInsert);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session.setTabSize(len);
|
||||||
|
session.setUseSoftTabs(ch == " ");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.$parseStringArg = function(text) {
|
||||||
|
var indent = {};
|
||||||
|
if (/t/.test(text))
|
||||||
|
indent.ch = "\t";
|
||||||
|
else if (/s/.test(text))
|
||||||
|
indent.ch = " ";
|
||||||
|
var m = text.match(/\d+/);
|
||||||
|
if (m)
|
||||||
|
indent.length = parseInt(m[0], 10);
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.$parseArg = function(arg) {
|
||||||
|
if (!arg)
|
||||||
|
return {};
|
||||||
|
if (typeof arg == "string")
|
||||||
|
return exports.$parseStringArg(arg);
|
||||||
|
if (typeof arg.text == "string")
|
||||||
|
return exports.$parseStringArg(arg.text);
|
||||||
|
return arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.commands = [{
|
||||||
|
name: "detectIndentation",
|
||||||
|
exec: function(editor) {
|
||||||
|
exports.detectIndentation(editor.session);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "trimTrailingSpace",
|
||||||
|
exec: function(editor) {
|
||||||
|
exports.trimTrailingSpace(editor.session);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "convertIndentation",
|
||||||
|
exec: function(editor, arg) {
|
||||||
|
var indent = exports.$parseArg(arg);
|
||||||
|
exports.convertIndentation(editor.session, indent.ch, indent.length);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
name: "setIndentation",
|
||||||
|
exec: function(editor, arg) {
|
||||||
|
var indent = exports.$parseArg(arg);
|
||||||
|
indent.length && editor.session.setTabSize(indent.length);
|
||||||
|
indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
});
|
||||||
1100
src/main/webapp/assets/ace/keybinding-emacs.js
Normal file
1100
src/main/webapp/assets/ace/keybinding-emacs.js
Normal file
File diff suppressed because it is too large
Load Diff
1764
src/main/webapp/assets/ace/keybinding-vim.js
Normal file
1764
src/main/webapp/assets/ace/keybinding-vim.js
Normal file
File diff suppressed because it is too large
Load Diff
260
src/main/webapp/assets/ace/mode-abap.js
Normal file
260
src/main/webapp/assets/ace/mode-abap.js
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/abap', ['require', 'exports', 'module' , 'ace/mode/abap_highlight_rules', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/lib/oop'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Rules = require("./abap_highlight_rules").AbapHighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
|
||||||
|
function Mode() {
|
||||||
|
this.HighlightRules = Rules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.toggleCommentLines = function(state, doc, startRow, endRow){
|
||||||
|
var range = new Range(0, 0, 0, 0);
|
||||||
|
for (var i = startRow; i <= endRow; ++i) {
|
||||||
|
var line = doc.getLine(i);
|
||||||
|
if (hereComment.test(line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (commentLine.test(line))
|
||||||
|
line = line.replace(commentLine, '$1');
|
||||||
|
else
|
||||||
|
line = line.replace(indentation, '$&#');
|
||||||
|
|
||||||
|
range.end.row = range.start.row = i;
|
||||||
|
range.end.column = line.length + 1;
|
||||||
|
doc.replace(range, line);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/abap";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/abap_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var AbapHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language": "this",
|
||||||
|
"keyword":
|
||||||
|
"ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK" +
|
||||||
|
" CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" +
|
||||||
|
" DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO" +
|
||||||
|
" ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" +
|
||||||
|
" FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" +
|
||||||
|
" GENERATE GET" +
|
||||||
|
" HIDE" +
|
||||||
|
" IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" +
|
||||||
|
" LEAVE LIKE LINE LOAD LOCAL LOOP" +
|
||||||
|
" MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" +
|
||||||
|
" ON OVERLAY OPTIONAL OTHERS" +
|
||||||
|
" PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" +
|
||||||
|
" RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK" +
|
||||||
|
" SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" +
|
||||||
|
" TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" +
|
||||||
|
" UNASSIGN ULINE UNPACK UPDATE" +
|
||||||
|
" WHEN WHILE WINDOW WRITE" +
|
||||||
|
" OCCURS STRUCTURE OBJECT PROPERTY" +
|
||||||
|
" CASTING APPEND RAISING VALUE COLOR" +
|
||||||
|
" CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" +
|
||||||
|
" ID NUMBER FOR TITLE OUTPUT" +
|
||||||
|
" WITH EXIT USING" +
|
||||||
|
" INTO WHERE GROUP BY HAVING ORDER BY SINGLE" +
|
||||||
|
" APPENDING CORRESPONDING FIELDS OF TABLE" +
|
||||||
|
" LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" +
|
||||||
|
" EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN",
|
||||||
|
"constant.language":
|
||||||
|
"TRUE FALSE NULL SPACE",
|
||||||
|
"support.type":
|
||||||
|
"c n i p f d t x string xstring decfloat16 decfloat34",
|
||||||
|
"keyword.operator":
|
||||||
|
"abs sign ceil floor trunc frac acos asin atan cos sin tan" +
|
||||||
|
" abapOperator cosh sinh tanh exp log log10 sqrt" +
|
||||||
|
" strlen xstrlen charlen numofchar dbmaxlen lines"
|
||||||
|
}, "text", true, " ");
|
||||||
|
|
||||||
|
var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+
|
||||||
|
"EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+
|
||||||
|
"END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+
|
||||||
|
"RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+
|
||||||
|
"WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+
|
||||||
|
"(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+
|
||||||
|
"(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+
|
||||||
|
"LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+
|
||||||
|
"CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+
|
||||||
|
"FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+
|
||||||
|
"NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+
|
||||||
|
"START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+
|
||||||
|
"TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+
|
||||||
|
"IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{token : "string", regex : "`", next : "string"},
|
||||||
|
{token : "string", regex : "'", next : "qstring"},
|
||||||
|
{token : "doc.comment", regex : /^\*.+/},
|
||||||
|
{token : "comment", regex : /".+$/},
|
||||||
|
{token : "invalid", regex: "\\.{2,}"},
|
||||||
|
{token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/},
|
||||||
|
{token : "paren.lparen", regex : "[\\[({]"},
|
||||||
|
{token : "paren.rparen", regex : "[\\])}]"},
|
||||||
|
{token : "constant.numeric", regex: "[+-]?\\d+\\b"},
|
||||||
|
{token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/},
|
||||||
|
{token : "keyword", regex : compoundKeywords},
|
||||||
|
{token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/},
|
||||||
|
{token : keywordMapper, regex : "\\b\\w+\\b"},
|
||||||
|
{caseInsensitive: true}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{token : "constant.language.escape", regex : "''"},
|
||||||
|
{token : "string", regex : "'", next : "start"},
|
||||||
|
{defaultToken : "string"}
|
||||||
|
],
|
||||||
|
"string" : [
|
||||||
|
{token : "constant.language.escape", regex : "``"},
|
||||||
|
{token : "string", regex : "`", next : "start"},
|
||||||
|
{defaultToken : "string"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(AbapHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.AbapHighlightRules = AbapHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
256
src/main/webapp/assets/ace/mode-actionscript.js
Normal file
256
src/main/webapp/assets/ace/mode-actionscript.js
Normal file
File diff suppressed because one or more lines are too long
117
src/main/webapp/assets/ace/mode-ada.js
Normal file
117
src/main/webapp/assets/ace/mode-ada.js
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/ada', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/ada_highlight_rules', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = AdaHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
|
||||||
|
this.$id = "ace/mode/ada";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/ada_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var AdaHighlightRules = function() {
|
||||||
|
var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
|
||||||
|
"access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
|
||||||
|
"array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
|
||||||
|
"body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
|
||||||
|
"|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"true|false|null"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"count|min|max|avg|sum|rank|now|coalesce|main"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier", true);
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment",
|
||||||
|
regex : "--.*$"
|
||||||
|
}, {
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '".*?"'
|
||||||
|
}, {
|
||||||
|
token : "string", // ' string
|
||||||
|
regex : "'.*?'"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\(]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\)]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(AdaHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.AdaHighlightRules = AdaHighlightRules;
|
||||||
|
});
|
||||||
345
src/main/webapp/assets/ace/mode-apache_conf.js
Normal file
345
src/main/webapp/assets/ace/mode-apache_conf.js
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/apache_conf', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/apache_conf_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = ApacheConfHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.$id = "ace/mode/apache_conf";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/apache_conf_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var ApacheConfHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.comment.apacheconf',
|
||||||
|
'comment.line.hash.ini',
|
||||||
|
'comment.line.hash.ini' ],
|
||||||
|
regex: '^((?:\\s)*)(#)(.*$)' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.tag.apacheconf',
|
||||||
|
'entity.tag.apacheconf',
|
||||||
|
'text',
|
||||||
|
'string.value.apacheconf',
|
||||||
|
'punctuation.definition.tag.apacheconf' ],
|
||||||
|
regex: '(<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(?:(\\s)(.+?))?(>)' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.tag.apacheconf',
|
||||||
|
'entity.tag.apacheconf',
|
||||||
|
'punctuation.definition.tag.apacheconf' ],
|
||||||
|
regex: '(</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(>)' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.alias.apacheconf', 'text',
|
||||||
|
'string.regexp.apacheconf', 'text',
|
||||||
|
'string.replacement.apacheconf', 'text' ],
|
||||||
|
regex: '(Rewrite(?:Rule|Cond))(\\s+)(.+?)(\\s+)(.+?)($|\\s)' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.alias.apacheconf', 'text',
|
||||||
|
'entity.status.apacheconf', 'text',
|
||||||
|
'string.regexp.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text' ],
|
||||||
|
regex: '(RedirectMatch)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.alias.apacheconf', 'text',
|
||||||
|
'entity.status.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text' ],
|
||||||
|
regex: '(Redirect)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.alias.apacheconf', 'text',
|
||||||
|
'string.regexp.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text' ],
|
||||||
|
regex: '(ScriptAliasMatch|AliasMatch)(\\s+)(.+?)(\\s+)(?:(.+?)(\\s))?' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.alias.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text',
|
||||||
|
'string.path.apacheconf', 'text' ],
|
||||||
|
regex: '(RedirectPermanent|RedirectTemp|ScriptAlias|Alias)(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
|
||||||
|
{ token: 'keyword.core.apacheconf',
|
||||||
|
regex: '\\b(?:AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|TimeOut|TraceEnable|UseCanonicalName)\\b' },
|
||||||
|
{ token: 'keyword.mpm.apacheconf',
|
||||||
|
regex: '\\b(?:AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\\b' },
|
||||||
|
{ token: 'keyword.access.apacheconf',
|
||||||
|
regex: '\\b(?:Allow|Deny|Order)\\b' },
|
||||||
|
{ token: 'keyword.actions.apacheconf',
|
||||||
|
regex: '\\b(?:Action|Script)\\b' },
|
||||||
|
{ token: 'keyword.alias.apacheconf',
|
||||||
|
regex: '\\b(?:Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\\b' },
|
||||||
|
{ token: 'keyword.auth.apacheconf',
|
||||||
|
regex: '\\b(?:AuthAuthoritative|AuthGroupFile|AuthUserFile)\\b' },
|
||||||
|
{ token: 'keyword.auth_anon.apacheconf',
|
||||||
|
regex: '\\b(?:Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\\b' },
|
||||||
|
{ token: 'keyword.auth_dbm.apacheconf',
|
||||||
|
regex: '\\b(?:AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\\b' },
|
||||||
|
{ token: 'keyword.auth_digest.apacheconf',
|
||||||
|
regex: '\\b(?:AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)\\b' },
|
||||||
|
{ token: 'keyword.auth_ldap.apacheconf',
|
||||||
|
regex: '\\b(?:AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\\b' },
|
||||||
|
{ token: 'keyword.autoindex.apacheconf',
|
||||||
|
regex: '\\b(?:AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|ReadmeName)\\b' },
|
||||||
|
{ token: 'keyword.cache.apacheconf',
|
||||||
|
regex: '\\b(?:CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\\b' },
|
||||||
|
{ token: 'keyword.cern_meta.apacheconf',
|
||||||
|
regex: '\\b(?:MetaDir|MetaFiles|MetaSuffix)\\b' },
|
||||||
|
{ token: 'keyword.cgi.apacheconf',
|
||||||
|
regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength)\\b' },
|
||||||
|
{ token: 'keyword.cgid.apacheconf',
|
||||||
|
regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\\b' },
|
||||||
|
{ token: 'keyword.charset_lite.apacheconf',
|
||||||
|
regex: '\\b(?:CharsetDefault|CharsetOptions|CharsetSourceEnc)\\b' },
|
||||||
|
{ token: 'keyword.dav.apacheconf',
|
||||||
|
regex: '\\b(?:Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\\b' },
|
||||||
|
{ token: 'keyword.deflate.apacheconf',
|
||||||
|
regex: '\\b(?:DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\\b' },
|
||||||
|
{ token: 'keyword.dir.apacheconf',
|
||||||
|
regex: '\\b(?:DirectoryIndex|DirectorySlash)\\b' },
|
||||||
|
{ token: 'keyword.disk_cache.apacheconf',
|
||||||
|
regex: '\\b(?:CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\\b' },
|
||||||
|
{ token: 'keyword.dumpio.apacheconf',
|
||||||
|
regex: '\\b(?:DumpIOInput|DumpIOOutput)\\b' },
|
||||||
|
{ token: 'keyword.env.apacheconf',
|
||||||
|
regex: '\\b(?:PassEnv|SetEnv|UnsetEnv)\\b' },
|
||||||
|
{ token: 'keyword.expires.apacheconf',
|
||||||
|
regex: '\\b(?:ExpiresActive|ExpiresByType|ExpiresDefault)\\b' },
|
||||||
|
{ token: 'keyword.ext_filter.apacheconf',
|
||||||
|
regex: '\\b(?:ExtFilterDefine|ExtFilterOptions)\\b' },
|
||||||
|
{ token: 'keyword.file_cache.apacheconf',
|
||||||
|
regex: '\\b(?:CacheFile|MMapFile)\\b' },
|
||||||
|
{ token: 'keyword.headers.apacheconf',
|
||||||
|
regex: '\\b(?:Header|RequestHeader)\\b' },
|
||||||
|
{ token: 'keyword.imap.apacheconf',
|
||||||
|
regex: '\\b(?:ImapBase|ImapDefault|ImapMenu)\\b' },
|
||||||
|
{ token: 'keyword.include.apacheconf',
|
||||||
|
regex: '\\b(?:SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\\b' },
|
||||||
|
{ token: 'keyword.isapi.apacheconf',
|
||||||
|
regex: '\\b(?:ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\\b' },
|
||||||
|
{ token: 'keyword.ldap.apacheconf',
|
||||||
|
regex: '\\b(?:LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\\b' },
|
||||||
|
{ token: 'keyword.log.apacheconf',
|
||||||
|
regex: '\\b(?:BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\\b' },
|
||||||
|
{ token: 'keyword.mem_cache.apacheconf',
|
||||||
|
regex: '\\b(?:MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\\b' },
|
||||||
|
{ token: 'keyword.mime.apacheconf',
|
||||||
|
regex: '\\b(?:AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\\b' },
|
||||||
|
{ token: 'keyword.misc.apacheconf',
|
||||||
|
regex: '\\b(?:ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\\b' },
|
||||||
|
{ token: 'keyword.negotiation.apacheconf',
|
||||||
|
regex: '\\b(?:CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\\b' },
|
||||||
|
{ token: 'keyword.nw_ssl.apacheconf',
|
||||||
|
regex: '\\b(?:NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\\b' },
|
||||||
|
{ token: 'keyword.proxy.apacheconf',
|
||||||
|
regex: '\\b(?:AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\\b' },
|
||||||
|
{ token: 'keyword.rewrite.apacheconf',
|
||||||
|
regex: '\\b(?:RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\\b' },
|
||||||
|
{ token: 'keyword.setenvif.apacheconf',
|
||||||
|
regex: '\\b(?:BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\\b' },
|
||||||
|
{ token: 'keyword.so.apacheconf',
|
||||||
|
regex: '\\b(?:LoadFile|LoadModule)\\b' },
|
||||||
|
{ token: 'keyword.ssl.apacheconf',
|
||||||
|
regex: '\\b(?:SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth)\\b' },
|
||||||
|
{ token: 'keyword.usertrack.apacheconf',
|
||||||
|
regex: '\\b(?:CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\\b' },
|
||||||
|
{ token: 'keyword.vhost_alias.apacheconf',
|
||||||
|
regex: '\\b(?:VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\\b' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.php.apacheconf',
|
||||||
|
'text',
|
||||||
|
'entity.property.apacheconf',
|
||||||
|
'text',
|
||||||
|
'string.value.apacheconf',
|
||||||
|
'text' ],
|
||||||
|
regex: '\\b(php_value|php_flag)\\b(?:(\\s+)(.+?)(?:(\\s+)(.+?))?)?(\\s)' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.variable.apacheconf',
|
||||||
|
'variable.env.apacheconf',
|
||||||
|
'variable.misc.apacheconf',
|
||||||
|
'punctuation.variable.apacheconf' ],
|
||||||
|
regex: '(%\\{)(?:(HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\\})' },
|
||||||
|
{ token: [ 'entity.mime-type.apacheconf', 'text' ],
|
||||||
|
regex: '\\b((?:text|image|application|video|audio)/.+?)(\\s)' },
|
||||||
|
{ token: 'entity.helper.apacheconf',
|
||||||
|
regex: '\\b(?:from|unset|set|on|off)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'constant.integer.apacheconf', regex: '\\b\\d+\\b' },
|
||||||
|
{ token:
|
||||||
|
[ 'text',
|
||||||
|
'punctuation.definition.flag.apacheconf',
|
||||||
|
'string.flag.apacheconf',
|
||||||
|
'punctuation.definition.flag.apacheconf',
|
||||||
|
'text' ],
|
||||||
|
regex: '(\\s)(\\[)(.*?)(\\])(\\s)' } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
ApacheConfHighlightRules.metaData = { fileTypes:
|
||||||
|
[ 'conf',
|
||||||
|
'CONF',
|
||||||
|
'htaccess',
|
||||||
|
'HTACCESS',
|
||||||
|
'htgroups',
|
||||||
|
'HTGROUPS',
|
||||||
|
'htpasswd',
|
||||||
|
'HTPASSWD',
|
||||||
|
'.htaccess',
|
||||||
|
'.HTACCESS',
|
||||||
|
'.htgroups',
|
||||||
|
'.HTGROUPS',
|
||||||
|
'.htpasswd',
|
||||||
|
'.HTPASSWD' ],
|
||||||
|
name: 'Apache Conf',
|
||||||
|
scopeName: 'source.apacheconf' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(ApacheConfHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ApacheConfHighlightRules = ApacheConfHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
372
src/main/webapp/assets/ace/mode-asciidoc.js
Normal file
372
src/main/webapp/assets/ace/mode-asciidoc.js
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/asciidoc_highlight_rules', 'ace/mode/folding/asciidoc'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
|
||||||
|
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = AsciidocHighlightRules;
|
||||||
|
|
||||||
|
this.foldingRules = new AsciidocFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.type = "text";
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
if (state == "listblock") {
|
||||||
|
var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
|
||||||
|
if (match) {
|
||||||
|
return new Array(match[1].length + 1).join(" ") + match[2];
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.$getIndent(line);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.$id = "ace/mode/asciidoc";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/asciidoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var AsciidocHighlightRules = function() {
|
||||||
|
var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start": [
|
||||||
|
{token: "empty", regex: /$/},
|
||||||
|
{token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
|
||||||
|
{token: "literal", regex: /^-{4,}\s*$/, next: "literalBlock"},
|
||||||
|
{token: "string", regex: /^\+{4,}\s*$/, next: "passthroughBlock"},
|
||||||
|
{token: "keyword", regex: /^={4,}\s*$/},
|
||||||
|
{token: "text", regex: /^\s*$/},
|
||||||
|
{token: "empty", regex: "", next: "dissallowDelimitedBlock"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"dissallowDelimitedBlock": [
|
||||||
|
{include: "paragraphEnd"},
|
||||||
|
{token: "comment", regex: '^//.+$'},
|
||||||
|
{token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"},
|
||||||
|
|
||||||
|
{include: "listStart"},
|
||||||
|
{token: "literal", regex: /^\s+.+$/, next: "indentedBlock"},
|
||||||
|
{token: "empty", regex: "", next: "text"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"paragraphEnd": [
|
||||||
|
{token: "doc.comment", regex: /^\/{4,}\s*$/, next: "commentBlock"},
|
||||||
|
{token: "tableBlock", regex: /^\s*[|!]=+\s*$/, next: "tableBlock"},
|
||||||
|
{token: "keyword", regex: /^(?:--|''')\s*$/, next: "start"},
|
||||||
|
{token: "option", regex: /^\[.*\]\s*$/, next: "start"},
|
||||||
|
{token: "pageBreak", regex: /^>{3,}$/, next: "start"},
|
||||||
|
{token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
|
||||||
|
{token: "titleUnderline", regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"},
|
||||||
|
{token: "singleLineTitle", regex: /^={1,5}\s+\S.*$/, next: "start"},
|
||||||
|
|
||||||
|
{token: "otherBlock", regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"},
|
||||||
|
{token: "optionalTitle", regex: /^\.[^.\s].+$/, next: "start"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"listStart": [
|
||||||
|
{token: "keyword", regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"},
|
||||||
|
{token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"},
|
||||||
|
{token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"},
|
||||||
|
{token: "keyword", regex: /^\+\s*$/, next: "start"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"text": [
|
||||||
|
{token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/},
|
||||||
|
{token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/},
|
||||||
|
{token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/},
|
||||||
|
{include: "macros"},
|
||||||
|
{include: "paragraphEnd"},
|
||||||
|
{token: "literal", regex:/\+{3,}/, next:"smallPassthrough"},
|
||||||
|
{token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/},
|
||||||
|
{token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/},
|
||||||
|
{token: "keyword", regex: /\s\+$/},
|
||||||
|
{token: "text", regex: identifierRe},
|
||||||
|
{token: ["keyword", "string", "keyword"],
|
||||||
|
regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/},
|
||||||
|
{token: "keyword", regex: /<<[\w\d\-$]+,?|>>/},
|
||||||
|
{token: "constant.character", regex: /\({2,3}.*?\){2,3}/},
|
||||||
|
{token: "keyword", regex: /\[\[.+?\]\]/},
|
||||||
|
{token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/},
|
||||||
|
|
||||||
|
{include: "quotes"},
|
||||||
|
{token: "empty", regex: /^\s*$/, next: "start"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"listText": [
|
||||||
|
{include: "listStart"},
|
||||||
|
{include: "text"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"indentedBlock": [
|
||||||
|
{token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"},
|
||||||
|
{token: "literal", regex: "", next: "start"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"listingBlock": [
|
||||||
|
{token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "constant.numeric", regex: '<\\d+>'},
|
||||||
|
{token: "literal", regex: '[^<]+'},
|
||||||
|
{token: "literal", regex: '<'}
|
||||||
|
],
|
||||||
|
"literalBlock": [
|
||||||
|
{token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "constant.numeric", regex: '<\\d+>'},
|
||||||
|
{token: "literal", regex: '[^<]+'},
|
||||||
|
{token: "literal", regex: '<'}
|
||||||
|
],
|
||||||
|
"passthroughBlock": [
|
||||||
|
{token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "literal", regex: identifierRe + "|\\d+"},
|
||||||
|
{include: "macros"},
|
||||||
|
{token: "literal", regex: "."}
|
||||||
|
],
|
||||||
|
|
||||||
|
"smallPassthrough": [
|
||||||
|
{token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "literal", regex: identifierRe + "|\\d+"},
|
||||||
|
{include: "macros"}
|
||||||
|
],
|
||||||
|
|
||||||
|
"commentBlock": [
|
||||||
|
{token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "doc.comment", regex: '^.*$'}
|
||||||
|
],
|
||||||
|
"tableBlock": [
|
||||||
|
{token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"},
|
||||||
|
{token: "tableBlock", regex: /\|/},
|
||||||
|
{include: "text", noEscape: true}
|
||||||
|
],
|
||||||
|
"innerTableBlock": [
|
||||||
|
{token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"},
|
||||||
|
{token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"},
|
||||||
|
{token: "tableBlock", regex: /\!/}
|
||||||
|
],
|
||||||
|
"macros": [
|
||||||
|
{token: "macro", regex: /{[\w\-$]+}/},
|
||||||
|
{token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/},
|
||||||
|
{token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/},
|
||||||
|
{token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/},
|
||||||
|
{token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/},
|
||||||
|
{token: "keyword", regex: /^:.+?:(?= |$)/}
|
||||||
|
],
|
||||||
|
|
||||||
|
"quotes": [
|
||||||
|
{token: "string.italic", regex: /__[^_\s].*?__/},
|
||||||
|
{token: "string.italic", regex: quoteRule("_")},
|
||||||
|
|
||||||
|
{token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/},
|
||||||
|
{token: "keyword.bold", regex: quoteRule("\\*")},
|
||||||
|
|
||||||
|
{token: "literal", regex: quoteRule("\\+")},
|
||||||
|
{token: "literal", regex: /\+\+[^+\s].*?\+\+/},
|
||||||
|
{token: "literal", regex: /\$\$.+?\$\$/},
|
||||||
|
{token: "literal", regex: quoteRule("`")},
|
||||||
|
|
||||||
|
{token: "keyword", regex: quoteRule("^")},
|
||||||
|
{token: "keyword", regex: quoteRule("~")},
|
||||||
|
{token: "keyword", regex: /##?/},
|
||||||
|
{token: "keyword", regex: /(?:\B|^)``|\b''/}
|
||||||
|
]
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function quoteRule(ch) {
|
||||||
|
var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)";
|
||||||
|
return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])";
|
||||||
|
}
|
||||||
|
|
||||||
|
var tokenMap = {
|
||||||
|
macro: "constant.character",
|
||||||
|
tableBlock: "doc.comment",
|
||||||
|
titleUnderline: "markup.heading",
|
||||||
|
singleLineTitle: "markup.heading",
|
||||||
|
pageBreak: "string",
|
||||||
|
option: "string.regexp",
|
||||||
|
otherBlock: "markup.list",
|
||||||
|
literal: "support.function",
|
||||||
|
optionalTitle: "constant.numeric",
|
||||||
|
escape: "constant.language.escape",
|
||||||
|
link: "markup.underline.list"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var state in this.$rules) {
|
||||||
|
var stateRules = this.$rules[state];
|
||||||
|
for (var i = stateRules.length; i--; ) {
|
||||||
|
var rule = stateRules[i];
|
||||||
|
if (rule.include || typeof rule == "string") {
|
||||||
|
var args = [i, 1].concat(this.$rules[rule.include || rule]);
|
||||||
|
if (rule.noEscape) {
|
||||||
|
args = args.filter(function(x) {
|
||||||
|
return !x.next;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
stateRules.splice.apply(stateRules, args);
|
||||||
|
} else if (rule.token in tokenMap) {
|
||||||
|
rule.token = tokenMap[rule.token];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(AsciidocHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.AsciidocHighlightRules = AsciidocHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/;
|
||||||
|
this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/;
|
||||||
|
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
if (!this.foldingStartMarker.test(line))
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if (line[0] == "=") {
|
||||||
|
if (this.singleLineHeadingRe.test(line))
|
||||||
|
return "start";
|
||||||
|
if (session.getLine(row - 1).length != session.getLine(row).length)
|
||||||
|
return "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
|
||||||
|
return "end";
|
||||||
|
return "start";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
if (!line.match(this.foldingStartMarker))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var token;
|
||||||
|
function getTokenType(row) {
|
||||||
|
token = session.getTokens(row)[0];
|
||||||
|
return token && token.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
var levels = ["=","-","~","^","+"];
|
||||||
|
var heading = "markup.heading";
|
||||||
|
var singleLineHeadingRe = this.singleLineHeadingRe;
|
||||||
|
function getLevel() {
|
||||||
|
var match = token.value.match(singleLineHeadingRe);
|
||||||
|
if (match)
|
||||||
|
return match[0].length;
|
||||||
|
var level = levels.indexOf(token.value[0]) + 1;
|
||||||
|
if (level == 1) {
|
||||||
|
if (session.getLine(row - 1).length != session.getLine(row).length)
|
||||||
|
return Infinity;
|
||||||
|
}
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTokenType(row) == heading) {
|
||||||
|
var startHeadingLevel = getLevel();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
if (getTokenType(row) != heading)
|
||||||
|
continue;
|
||||||
|
var level = getLevel();
|
||||||
|
if (level <= startHeadingLevel)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe);
|
||||||
|
endRow = isSingleLineHeading ? row - 1 : row - 2;
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "["))
|
||||||
|
endRow--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var state = session.bgTokenizer.getState(row);
|
||||||
|
if (state == "dissallowDelimitedBlock") {
|
||||||
|
while (row -- > 0) {
|
||||||
|
if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
endRow = row + 1;
|
||||||
|
if (endRow < startRow) {
|
||||||
|
var endColumn = session.getLine(row).length;
|
||||||
|
return new Range(endRow, 5, startRow, startColumn - 5);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (++row < maxRow) {
|
||||||
|
if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(row).length;
|
||||||
|
return new Range(startRow, 5, endRow, endColumn - 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
216
src/main/webapp/assets/ace/mode-assembly_x86.js
Normal file
216
src/main/webapp/assets/ace/mode-assembly_x86.js
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/assembly_x86', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/assembly_x86_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = AssemblyX86HighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = ";";
|
||||||
|
this.$id = "ace/mode/assembly_x86";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/assembly_x86_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var AssemblyX86HighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { token: 'keyword.control.assembly',
|
||||||
|
regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'variable.parameter.register.assembly',
|
||||||
|
regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'constant.character.decimal.assembly',
|
||||||
|
regex: '\\b[0-9]+\\b' },
|
||||||
|
{ token: 'constant.character.hexadecimal.assembly',
|
||||||
|
regex: '\\b0x[A-F0-9]+\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'constant.character.hexadecimal.assembly',
|
||||||
|
regex: '\\b[A-F0-9]+h\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'string.assembly', regex: /'([^\\']|\\.)*'/ },
|
||||||
|
{ token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ },
|
||||||
|
{ token: 'support.function.directive.assembly',
|
||||||
|
regex: '^\\[',
|
||||||
|
push:
|
||||||
|
[ { token: 'support.function.directive.assembly',
|
||||||
|
regex: '\\]$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'support.function.directive.assembly' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'support.function.directive.assembly',
|
||||||
|
'support.function.directive.assembly',
|
||||||
|
'entity.name.function.assembly' ],
|
||||||
|
regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' },
|
||||||
|
{ token: 'support.function.directive.assembly',
|
||||||
|
regex: '^endstruc\\b' },
|
||||||
|
{ token:
|
||||||
|
[ 'support.function.directive.assembly',
|
||||||
|
'entity.name.function.assembly',
|
||||||
|
'support.function.directive.assembly',
|
||||||
|
'constant.character.assembly' ],
|
||||||
|
regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' },
|
||||||
|
{ token: 'support.function.directive.assembly',
|
||||||
|
regex: '^%endmacro' },
|
||||||
|
{ token:
|
||||||
|
[ 'text',
|
||||||
|
'support.function.directive.assembly',
|
||||||
|
'text',
|
||||||
|
'entity.name.function.assembly' ],
|
||||||
|
regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'support.function.directive.assembly',
|
||||||
|
regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' },
|
||||||
|
{ token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' },
|
||||||
|
{ token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' },
|
||||||
|
{ token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' },
|
||||||
|
{ token: 'comment.assembly', regex: ';.*$' } ]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ],
|
||||||
|
name: 'Assembly x86',
|
||||||
|
scopeName: 'source.assembly' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(AssemblyX86HighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
224
src/main/webapp/assets/ace/mode-autohotkey.js
Normal file
224
src/main/webapp/assets/ace/mode-autohotkey.js
Normal file
File diff suppressed because one or more lines are too long
212
src/main/webapp/assets/ace/mode-batchfile.js
Normal file
212
src/main/webapp/assets/ace/mode-batchfile.js
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/batchfile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/batchfile_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = BatchFileHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "::";
|
||||||
|
this.blockComment = "";
|
||||||
|
this.$id = "ace/mode/batchfile";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/batchfile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var BatchFileHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { token: 'keyword.command.dosbatch',
|
||||||
|
regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'keyword.control.statement.dosbatch',
|
||||||
|
regex: '\\b(?:goto|call|exit)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'keyword.control.conditional.if.dosbatch',
|
||||||
|
regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'keyword.control.conditional.dosbatch',
|
||||||
|
regex: '\\b(?:if|else)\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'keyword.control.repeat.dosbatch',
|
||||||
|
regex: '\\bfor\\b',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'keyword.operator.dosbatch',
|
||||||
|
regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' },
|
||||||
|
{ token: ['doc.comment', 'comment'],
|
||||||
|
regex: '(?:^|\\b)(rem)($|\\s.*$)',
|
||||||
|
caseInsensitive: true },
|
||||||
|
{ token: 'comment.line.colons.dosbatch',
|
||||||
|
regex: '::.*$' },
|
||||||
|
{ include: 'variable' },
|
||||||
|
{ token: 'punctuation.definition.string.begin.shell',
|
||||||
|
regex: '"',
|
||||||
|
push: [
|
||||||
|
{ token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' },
|
||||||
|
{ include: 'variable' },
|
||||||
|
{ defaultToken: 'string.quoted.double.dosbatch' } ] },
|
||||||
|
{ token: 'keyword.operator.pipe.dosbatch', regex: '[|]' },
|
||||||
|
{ token: 'keyword.operator.redirect.shell',
|
||||||
|
regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' } ],
|
||||||
|
variable: [
|
||||||
|
{ token: 'constant.numeric', regex: '%%\\w+|%[*\\d]|%\\w+%'},
|
||||||
|
{ token: 'constant.numeric', regex: '%~\\d+'},
|
||||||
|
{ token: ['markup.list', 'constant.other', 'markup.list'],
|
||||||
|
regex: '(%)(\\w+)(%?)' }]}
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
BatchFileHighlightRules.metaData = { name: 'Batch File',
|
||||||
|
scopeName: 'source.dosbatch',
|
||||||
|
fileTypes: [ 'bat' ] }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(BatchFileHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.BatchFileHighlightRules = BatchFileHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
307
src/main/webapp/assets/ace/mode-c9search.js
Normal file
307
src/main/webapp/assets/ace/mode-c9search.js
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/c9search_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/c9search'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var C9StyleFoldMode = require("./folding/c9search").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = C9SearchHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new C9StyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/c9search";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/c9search_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
function safeCreateRegexp(source, flag) {
|
||||||
|
try {
|
||||||
|
return new RegExp(source, flag);
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
var C9SearchHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
tokenNames : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text", "c9searchresults.keyword"],
|
||||||
|
regex : "(^\\s+[0-9]+)(:\\s)(.+)",
|
||||||
|
onMatch : function(val, state, stack) {
|
||||||
|
var values = this.splitRegex.exec(val);
|
||||||
|
var types = this.tokenNames;
|
||||||
|
var tokens = [{
|
||||||
|
type: types[0],
|
||||||
|
value: values[1]
|
||||||
|
},{
|
||||||
|
type: types[1],
|
||||||
|
value: values[2]
|
||||||
|
}];
|
||||||
|
|
||||||
|
var regex = stack[1];
|
||||||
|
var str = values[3];
|
||||||
|
|
||||||
|
var m;
|
||||||
|
var last = 0;
|
||||||
|
if (regex && regex.exec) {
|
||||||
|
regex.lastIndex = 0;
|
||||||
|
while (m = regex.exec(str)) {
|
||||||
|
var skipped = str.substring(last, m.index);
|
||||||
|
last = regex.lastIndex;
|
||||||
|
if (skipped)
|
||||||
|
tokens.push({type: types[2], value: skipped});
|
||||||
|
if (m[0])
|
||||||
|
tokens.push({type: types[3], value: m[0]});
|
||||||
|
else if (!skipped)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (last < str.length)
|
||||||
|
tokens.push({type: types[2], value: str.substr(last)});
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : ["string", "text"], // single line
|
||||||
|
regex : "(\\S.*)(:$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex : "Searching for .*$",
|
||||||
|
onMatch: function(val, state, stack) {
|
||||||
|
var parts = val.split("\x01");
|
||||||
|
if (parts.length < 3)
|
||||||
|
return "text";
|
||||||
|
|
||||||
|
var options, search, replace;
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
var tokens = [{
|
||||||
|
value: parts[i++] + "'",
|
||||||
|
type: "text"
|
||||||
|
}, {
|
||||||
|
value: search = parts[i++],
|
||||||
|
type: "text" // "c9searchresults.keyword"
|
||||||
|
}, {
|
||||||
|
value: "'" + parts[i++],
|
||||||
|
type: "text"
|
||||||
|
}];
|
||||||
|
if (parts[2] !== " in") {
|
||||||
|
replace = parts[i];
|
||||||
|
tokens.push({
|
||||||
|
value: "'" + parts[i++] + "'",
|
||||||
|
type: "text"
|
||||||
|
}, {
|
||||||
|
value: parts[i++],
|
||||||
|
type: "text"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
tokens.push({
|
||||||
|
value: " " + parts[i++] + " ",
|
||||||
|
type: "text"
|
||||||
|
});
|
||||||
|
if (parts[i+1]) {
|
||||||
|
options = parts[i+1];
|
||||||
|
tokens.push({
|
||||||
|
value: "(" + parts[i+1] + ")",
|
||||||
|
type: "text"
|
||||||
|
});
|
||||||
|
i += 1;
|
||||||
|
} else {
|
||||||
|
i -= 1;
|
||||||
|
}
|
||||||
|
while (i++ < parts.length) {
|
||||||
|
parts[i] && tokens.push({
|
||||||
|
value: parts[i],
|
||||||
|
type: "text"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replace) {
|
||||||
|
search = replace;
|
||||||
|
options = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (search) {
|
||||||
|
if (!/regex/.test(options))
|
||||||
|
search = lang.escapeRegExp(search);
|
||||||
|
if (/whole/.test(options))
|
||||||
|
search = "\\b" + search + "\\b";
|
||||||
|
}
|
||||||
|
|
||||||
|
var regex = search && safeCreateRegexp(
|
||||||
|
"(" + search + ")",
|
||||||
|
/ sensitive/.test(options) ? "g" : "ig"
|
||||||
|
);
|
||||||
|
if (regex) {
|
||||||
|
stack[0] = state;
|
||||||
|
stack[1] = regex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex : "\\d+",
|
||||||
|
token: "constant.numeric"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(C9SearchHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.C9SearchHighlightRules = C9SearchHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /^(\S.*\:|Searching for.*)$/;
|
||||||
|
this.foldingStopMarker = /^(\s+|Found.*)$/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var lines = session.doc.getAllLines(row);
|
||||||
|
var line = lines[row];
|
||||||
|
var level1 = /^(Found.*|Searching for.*)$/;
|
||||||
|
var level2 = /^(\S.*\:|\s*)$/;
|
||||||
|
var re = level1.test(line) ? level1 : level2;
|
||||||
|
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
if (this.foldingStartMarker.test(line)) {
|
||||||
|
for (var i = row + 1, l = session.getLength(); i < l; i++) {
|
||||||
|
if (re.test(lines[i]))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
endRow = i;
|
||||||
|
}
|
||||||
|
else if (this.foldingStopMarker.test(line)) {
|
||||||
|
for (var i = row - 1; i >= 0; i--) {
|
||||||
|
line = lines[i];
|
||||||
|
if (re.test(line))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
startRow = i;
|
||||||
|
}
|
||||||
|
if (startRow != endRow) {
|
||||||
|
var col = line.length;
|
||||||
|
if (re === level1)
|
||||||
|
col = line.search(/\(Found[^)]+\)$|$/);
|
||||||
|
return new Range(startRow, col, endRow, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
815
src/main/webapp/assets/ace/mode-c_cpp.js
Normal file
815
src/main/webapp/assets/ace/mode-c_cpp.js
Normal file
@@ -0,0 +1,815 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = c_cppHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
} else if (state == "doc-start") {
|
||||||
|
if (endState == "start") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var match = line.match(/^\s*(\/?)\*/);
|
||||||
|
if (match) {
|
||||||
|
if (match[1]) {
|
||||||
|
indent += " ";
|
||||||
|
}
|
||||||
|
indent += "* ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/c_cpp";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
|
||||||
|
|
||||||
|
var c_cppHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordControls = (
|
||||||
|
"break|case|continue|default|do|else|for|goto|if|_Pragma|" +
|
||||||
|
"return|switch|while|catch|operator|try|throw|using"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageType = (
|
||||||
|
"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
|
||||||
|
"_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
|
||||||
|
"class|wchar_t|template"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageModifiers = (
|
||||||
|
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
||||||
|
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordOperators = (
|
||||||
|
"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
|
||||||
|
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"NULL|true|false|TRUE|FALSE"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
||||||
|
"keyword.control" : keywordControls,
|
||||||
|
"storage.type" : storageType,
|
||||||
|
"storage.modifier" : storageModifiers,
|
||||||
|
"keyword.operator" : keywordOperators,
|
||||||
|
"variable.language": "this",
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '["].*\\\\$',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : "['].*\\\\$",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // pre-compiler directives
|
||||||
|
regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
|
||||||
|
next : "directive"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // special case pre-compiler directive
|
||||||
|
regex : "(?:#\\s*endif)\\b"
|
||||||
|
}, {
|
||||||
|
token : "support.function.C99.c",
|
||||||
|
regex : cFunctions
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directive" : [
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /.*\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : "\\s*<.+?>",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : /[^\\\/]+/,
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
232
src/main/webapp/assets/ace/mode-cirru.js
Normal file
232
src/main/webapp/assets/ace/mode-cirru.js
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/cirru', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/cirru_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules;
|
||||||
|
var CoffeeFoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = CirruHighlightRules;
|
||||||
|
this.foldingRules = new CoffeeFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
this.$id = "ace/mode/cirru";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/cirru_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var CirruHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
start: [{
|
||||||
|
token: 'constant.numeric',
|
||||||
|
regex: /[\d\.]+/
|
||||||
|
}, {
|
||||||
|
token: 'comment.line.double-dash',
|
||||||
|
regex: /--/,
|
||||||
|
next: 'comment',
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\(/,
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\,/,
|
||||||
|
next: 'line',
|
||||||
|
}, {
|
||||||
|
token: 'support.function',
|
||||||
|
regex: /[^\(\)\"\s]+/,
|
||||||
|
next: 'line'
|
||||||
|
}, {
|
||||||
|
token: 'string.quoted.double',
|
||||||
|
regex: /"/,
|
||||||
|
next: 'string',
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\)/,
|
||||||
|
}],
|
||||||
|
comment: [{
|
||||||
|
token: 'comment.line.double-dash',
|
||||||
|
regex: /\ +[^\n]+/,
|
||||||
|
next: 'start',
|
||||||
|
}],
|
||||||
|
string: [{
|
||||||
|
token: 'string.quoted.double',
|
||||||
|
regex: /"/,
|
||||||
|
next: 'line',
|
||||||
|
}, {
|
||||||
|
token: 'constant.character.escape',
|
||||||
|
regex: /\\/,
|
||||||
|
next: 'escape',
|
||||||
|
}, {
|
||||||
|
token: 'string.quoted.double',
|
||||||
|
regex: /[^\\\"]+/,
|
||||||
|
}],
|
||||||
|
escape: [{
|
||||||
|
token: 'constant.character.escape',
|
||||||
|
regex: /./,
|
||||||
|
next: 'string',
|
||||||
|
}],
|
||||||
|
line: [{
|
||||||
|
token: 'constant.numeric',
|
||||||
|
regex: /[\d\.]+/
|
||||||
|
}, {
|
||||||
|
token: 'markup.raw',
|
||||||
|
regex: /^\s*/,
|
||||||
|
next: 'start',
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\$/,
|
||||||
|
next: 'start',
|
||||||
|
}, {
|
||||||
|
token: 'variable.parameter',
|
||||||
|
regex: /[^\(\)\"\s]+/
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\(/,
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'storage.modifier',
|
||||||
|
regex: /\)/,
|
||||||
|
}, {
|
||||||
|
token: 'markup.raw',
|
||||||
|
regex: /^\ */,
|
||||||
|
next: 'start',
|
||||||
|
}, {
|
||||||
|
token: 'string.quoted.double',
|
||||||
|
regex: /"/,
|
||||||
|
next: 'string',
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(CirruHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.CirruHighlightRules = CirruHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
299
src/main/webapp/assets/ace/mode-clojure.js
Normal file
299
src/main/webapp/assets/ace/mode-clojure.js
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/clojure', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/clojure_highlight_rules', 'ace/mode/matching_parens_outdent', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
|
||||||
|
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = ClojureHighlightRules;
|
||||||
|
this.$outdent = new MatchingParensOutdent();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = ";";
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/[\(\[]/);
|
||||||
|
if (match) {
|
||||||
|
indent += " ";
|
||||||
|
}
|
||||||
|
match = line.match(/[\)]/);
|
||||||
|
if (match) {
|
||||||
|
indent = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/clojure";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/clojure_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var ClojureHighlightRules = function() {
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
'* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
|
||||||
|
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
|
||||||
|
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
|
||||||
|
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
|
||||||
|
'*read-eval* *source-path* *use-context-classloader* ' +
|
||||||
|
'*warn-on-reflection* + - -> ->> .. / < <= = ' +
|
||||||
|
'== > > >= >= accessor aclone ' +
|
||||||
|
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
|
||||||
|
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
|
||||||
|
'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
|
||||||
|
'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
|
||||||
|
'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
|
||||||
|
'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
|
||||||
|
'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
|
||||||
|
'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
|
||||||
|
'char-escape-string char-name-string char? chars chunk chunk-append ' +
|
||||||
|
'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
|
||||||
|
'class class? clear-agent-errors clojure-version coll? comment commute ' +
|
||||||
|
'comp comparator compare compare-and-set! compile complement concat cond ' +
|
||||||
|
'condp conj conj! cons constantly construct-proxy contains? count ' +
|
||||||
|
'counted? create-ns create-struct cycle dec decimal? declare definline ' +
|
||||||
|
'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
|
||||||
|
'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
|
||||||
|
'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
|
||||||
|
'double-array doubles drop drop-last drop-while empty empty? ensure ' +
|
||||||
|
'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
|
||||||
|
'find-doc find-ns find-var first float float-array float? floats flush ' +
|
||||||
|
'fn fn? fnext for force format future future-call future-cancel ' +
|
||||||
|
'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
|
||||||
|
'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
|
||||||
|
'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
|
||||||
|
'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
|
||||||
|
'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
|
||||||
|
'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
|
||||||
|
'list* list? load load-file load-reader load-string loaded-libs locking ' +
|
||||||
|
'long long-array longs loop macroexpand macroexpand-1 make-array ' +
|
||||||
|
'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
|
||||||
|
'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
|
||||||
|
'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
|
||||||
|
'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
|
||||||
|
'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
|
||||||
|
'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
|
||||||
|
'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
|
||||||
|
'primitives-classnames print print-ctor print-doc print-dup print-method ' +
|
||||||
|
'print-namespace-doc print-simple print-special-doc print-str printf ' +
|
||||||
|
'println println-str prn prn-str promise proxy proxy-call-with-super ' +
|
||||||
|
'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
|
||||||
|
'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
|
||||||
|
're-matcher re-matches re-pattern re-seq read read-line read-string ' +
|
||||||
|
'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
|
||||||
|
'refer refer-clojure release-pending-sends rem remove remove-method ' +
|
||||||
|
'remove-ns remove-watch repeat repeatedly replace replicate require ' +
|
||||||
|
'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
|
||||||
|
'rsubseq second select-keys send send-off seq seq? seque sequence ' +
|
||||||
|
'sequential? set set-validator! set? short short-array shorts ' +
|
||||||
|
'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
|
||||||
|
'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
|
||||||
|
'split-at split-with str stream? string? struct struct-map subs subseq ' +
|
||||||
|
'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
|
||||||
|
'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
|
||||||
|
'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
|
||||||
|
'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
|
||||||
|
'unchecked-remainder unchecked-subtract underive unquote ' +
|
||||||
|
'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
|
||||||
|
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
|
||||||
|
'while with-bindings with-bindings* with-in-str with-loading-context ' +
|
||||||
|
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
|
||||||
|
'zero? zipmap'
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywords = ('throw try var ' +
|
||||||
|
'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = ("true false nil");
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants,
|
||||||
|
"support.function": builtinFunctions
|
||||||
|
}, "identifier", false, " ");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : ";.*$"
|
||||||
|
}, {
|
||||||
|
token : "keyword", //parens
|
||||||
|
regex : "[\\(|\\)]"
|
||||||
|
}, {
|
||||||
|
token : "keyword", //lists
|
||||||
|
regex : "[\\'\\(]"
|
||||||
|
}, {
|
||||||
|
token : "keyword", //vectors
|
||||||
|
regex : "[\\[|\\]]"
|
||||||
|
}, {
|
||||||
|
token : "keyword", //sets and maps
|
||||||
|
regex : "[\\{|\\}|\\#\\{|\\#\\}]"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // ampersands
|
||||||
|
regex : '[\\&]'
|
||||||
|
}, {
|
||||||
|
token : "keyword", // metadata
|
||||||
|
regex : '[\\#\\^\\{]'
|
||||||
|
}, {
|
||||||
|
token : "keyword", // anonymous fn syntactic sugar
|
||||||
|
regex : '[\\%]'
|
||||||
|
}, {
|
||||||
|
token : "keyword", // deref reader macro
|
||||||
|
regex : '[@]'
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language",
|
||||||
|
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '"',
|
||||||
|
next: "string"
|
||||||
|
}, {
|
||||||
|
token : "constant", // symbol
|
||||||
|
regex : /:[^()\[\]{}'"\^%`,;\s]+/
|
||||||
|
}, {
|
||||||
|
token : "string.regexp", //Regular Expressions
|
||||||
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"string" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : "\\\\.|\\\\$"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '[^"\\\\]+'
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(ClojureHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ClojureHighlightRules = ClojureHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_parens_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingParensOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\)/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\))/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
var match = line.match(/^(\s+)/);
|
||||||
|
if (match) {
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingParensOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingParensOutdent = MatchingParensOutdent;
|
||||||
|
});
|
||||||
124
src/main/webapp/assets/ace/mode-cobol.js
Normal file
124
src/main/webapp/assets/ace/mode-cobol.js
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/cobol', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/cobol_highlight_rules', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = CobolHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "*";
|
||||||
|
|
||||||
|
this.$id = "ace/mode/cobol";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/cobol_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var CobolHighlightRules = function() {
|
||||||
|
var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" +
|
||||||
|
"AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" +
|
||||||
|
"ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" +
|
||||||
|
"TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" +
|
||||||
|
"UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" +
|
||||||
|
"PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" +
|
||||||
|
"CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" +
|
||||||
|
"COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" +
|
||||||
|
"RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" +
|
||||||
|
"DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" +
|
||||||
|
"ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" +
|
||||||
|
"EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT";
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"true|false|null"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"count|min|max|avg|sum|rank|now|coalesce|main"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier", true);
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\*.*$"
|
||||||
|
}, {
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '".*?"'
|
||||||
|
}, {
|
||||||
|
token : "string", // ' string
|
||||||
|
regex : "'.*?'"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\(]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\)]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(CobolHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.CobolHighlightRules = CobolHighlightRules;
|
||||||
|
});
|
||||||
442
src/main/webapp/assets/ace/mode-coffee.js
Normal file
442
src/main/webapp/assets/ace/mode-coffee.js
Normal file
@@ -0,0 +1,442 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/coffee', ['require', 'exports', 'module' , 'ace/mode/coffee_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/worker/worker_client', 'ace/lib/oop'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
||||||
|
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
|
||||||
|
function Mode() {
|
||||||
|
this.HighlightRules = Rules;
|
||||||
|
this.$outdent = new Outdent();
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
|
||||||
|
var commentLine = /^(\s*)#/;
|
||||||
|
var hereComment = /^\s*###(?!#)/;
|
||||||
|
var indentation = /^\s*/;
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||||
|
|
||||||
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||||
|
state === 'start' && indenter.test(line))
|
||||||
|
indent += tab;
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.toggleCommentLines = function(state, doc, startRow, endRow){
|
||||||
|
console.log("toggle");
|
||||||
|
var range = new Range(0, 0, 0, 0);
|
||||||
|
for (var i = startRow; i <= endRow; ++i) {
|
||||||
|
var line = doc.getLine(i);
|
||||||
|
if (hereComment.test(line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (commentLine.test(line))
|
||||||
|
line = line.replace(commentLine, '$1');
|
||||||
|
else
|
||||||
|
line = line.replace(indentation, '$&#');
|
||||||
|
|
||||||
|
range.end.row = range.start.row = i;
|
||||||
|
range.end.column = line.length + 1;
|
||||||
|
doc.replace(range, line);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/coffee";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
oop.inherits(CoffeeHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
function CoffeeHighlightRules() {
|
||||||
|
var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
|
||||||
|
"catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
|
||||||
|
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
|
||||||
|
"or|on|unless|until|and|yes"
|
||||||
|
);
|
||||||
|
|
||||||
|
var langConstant = (
|
||||||
|
"true|false|null|undefined|NaN|Infinity"
|
||||||
|
);
|
||||||
|
|
||||||
|
var illegal = (
|
||||||
|
"case|const|default|function|var|void|with|enum|export|implements|" +
|
||||||
|
"interface|let|package|private|protected|public|static|yield|" +
|
||||||
|
"__hasProp|slice|bind|indexOf"
|
||||||
|
);
|
||||||
|
|
||||||
|
var supportClass = (
|
||||||
|
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
|
||||||
|
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
|
||||||
|
"SyntaxError|TypeError|URIError|" +
|
||||||
|
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
||||||
|
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
|
||||||
|
);
|
||||||
|
|
||||||
|
var supportFunction = (
|
||||||
|
"Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
|
||||||
|
"encodeURIComponent|decodeURI|decodeURIComponent|String|"
|
||||||
|
);
|
||||||
|
|
||||||
|
var variableLanguage = (
|
||||||
|
"window|arguments|prototype|document"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": langConstant,
|
||||||
|
"invalid.illegal": illegal,
|
||||||
|
"language.support.class": supportClass,
|
||||||
|
"language.support.function": supportFunction,
|
||||||
|
"variable.language": variableLanguage
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var functionRule = {
|
||||||
|
token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
|
||||||
|
regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*))?([\-=]>)/.source
|
||||||
|
};
|
||||||
|
|
||||||
|
var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
start : [
|
||||||
|
{
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
|
||||||
|
}, {
|
||||||
|
stateName: "qdoc",
|
||||||
|
token : "string", regex : "'''", next : [
|
||||||
|
{token : "string", regex : "'''", next : "start"},
|
||||||
|
{token : "constant.language.escape", regex : stringEscape},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
stateName: "qqdoc",
|
||||||
|
token : "string",
|
||||||
|
regex : '"""',
|
||||||
|
next : [
|
||||||
|
{token : "string", regex : '"""', next : "start"},
|
||||||
|
{token : "paren.string", regex : '#{', push : "start"},
|
||||||
|
{token : "constant.language.escape", regex : stringEscape},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
stateName: "qstring",
|
||||||
|
token : "string", regex : "'", next : [
|
||||||
|
{token : "string", regex : "'", next : "start"},
|
||||||
|
{token : "constant.language.escape", regex : stringEscape},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
stateName: "qqstring",
|
||||||
|
token : "string.start", regex : '"', next : [
|
||||||
|
{token : "string.end", regex : '"', next : "start"},
|
||||||
|
{token : "paren.string", regex : '#{', push : "start"},
|
||||||
|
{token : "constant.language.escape", regex : stringEscape},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
stateName: "js",
|
||||||
|
token : "string", regex : "`", next : [
|
||||||
|
{token : "string", regex : "`", next : "start"},
|
||||||
|
{token : "constant.language.escape", regex : stringEscape},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
regex: "[{}]", onMatch: function(val, state, stack) {
|
||||||
|
this.next = "";
|
||||||
|
if (val == "{" && stack.length) {
|
||||||
|
stack.unshift("start", state);
|
||||||
|
return "paren";
|
||||||
|
}
|
||||||
|
if (val == "}" && stack.length) {
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack.shift();
|
||||||
|
if (this.next.indexOf("string") != -1)
|
||||||
|
return "paren.string";
|
||||||
|
}
|
||||||
|
return "paren";
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
token : "string.regex",
|
||||||
|
regex : "///",
|
||||||
|
next : "heregex"
|
||||||
|
}, {
|
||||||
|
token : "string.regex",
|
||||||
|
regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "###(?!#)",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation.operator", "text", "identifier"],
|
||||||
|
regex : "(\\.)(\\s*)(" + illegal + ")"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\."
|
||||||
|
}, {
|
||||||
|
token : ["keyword", "text", "language.support.class",
|
||||||
|
"text", "keyword", "text", "language.support.class"],
|
||||||
|
regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
|
||||||
|
}, {
|
||||||
|
token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
|
||||||
|
regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
|
||||||
|
},
|
||||||
|
functionRule,
|
||||||
|
{
|
||||||
|
token : "variable",
|
||||||
|
regex : "@(?:" + identifier + ")?"
|
||||||
|
}, {
|
||||||
|
token: keywordMapper,
|
||||||
|
regex : identifier
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\,|\\."
|
||||||
|
}, {
|
||||||
|
token : "storage.type",
|
||||||
|
regex : "[\\-=]>"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[({[]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\]})]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
heregex : [{
|
||||||
|
token : "string.regex",
|
||||||
|
regex : '.*?///[imgy]{0,4}',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment.regex",
|
||||||
|
regex : "\\s+(?:#.*)?"
|
||||||
|
}, {
|
||||||
|
token : "string.regex",
|
||||||
|
regex : "\\S+"
|
||||||
|
}],
|
||||||
|
|
||||||
|
comment : [{
|
||||||
|
token : "comment",
|
||||||
|
regex : '###',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
this.normalizeRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.CoffeeHighlightRules = CoffeeHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2385
src/main/webapp/assets/ace/mode-coldfusion.js
Normal file
2385
src/main/webapp/assets/ace/mode-coldfusion.js
Normal file
File diff suppressed because it is too large
Load Diff
797
src/main/webapp/assets/ace/mode-csharp.js
Normal file
797
src/main/webapp/assets/ace/mode-csharp.js
Normal file
@@ -0,0 +1,797 @@
|
|||||||
|
ace.define('ace/mode/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/csharp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/csharp'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/csharp").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = CSharpHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/csharp";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/csharp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var CSharpHighlightRules = function() {
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language": "this",
|
||||||
|
"keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
|
||||||
|
"constant.language": "null|true|false"
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // character
|
||||||
|
regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
|
||||||
|
}, {
|
||||||
|
token : "string", start : '"', end : '"|$', next: [
|
||||||
|
{token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
|
||||||
|
{token: "invalid", regex: /\\./}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
token : "string", start : '@"', end : '"', next:[
|
||||||
|
{token: "constant.language.escape", regex: '""'}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(CSharpHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.CSharpHighlightRules = CSharpHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var CFoldMode = require("./cstyle").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, CFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.usingRe = /^\s*using \S/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
|
||||||
|
this.getFoldWidgetBase = this.getFoldWidget;
|
||||||
|
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var fw = this.getFoldWidgetBase(session, foldStyle, row);
|
||||||
|
if (!fw) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
if (/^\s*#region\b/.test(line))
|
||||||
|
return "start";
|
||||||
|
var usingRe = this.usingRe;
|
||||||
|
if (usingRe.test(line)) {
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
if (!usingRe.test(prev) && usingRe.test(next))
|
||||||
|
return "start"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fw;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.getFoldWidgetRangeBase(session, foldStyle, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var line = session.getLine(row);
|
||||||
|
if (this.usingRe.test(line))
|
||||||
|
return this.getUsingStatementBlock(session, line, row);
|
||||||
|
|
||||||
|
if (/^\s*#region\b/.test(line))
|
||||||
|
return this.getRegionBlock(session, line, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getUsingStatementBlock = function(session, line, row) {
|
||||||
|
var startColumn = line.match(this.usingRe)[0].length - 1;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
if (/^\s*$/.test(line))
|
||||||
|
continue;
|
||||||
|
if (!this.usingRe.test(line))
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getRegionBlock = function(session, line, row) {
|
||||||
|
var startColumn = line.search(/\s*$/);
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
|
||||||
|
var re = /^\s*#(end)?region\b/
|
||||||
|
var depth = 1
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var m = re.exec(line);
|
||||||
|
if (!m)
|
||||||
|
continue;
|
||||||
|
if (m[1])
|
||||||
|
depth--;
|
||||||
|
else
|
||||||
|
depth++;
|
||||||
|
|
||||||
|
if (!depth)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var endRow = row;
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = line.search(/\S/);
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
814
src/main/webapp/assets/ace/mode-css.js
Normal file
814
src/main/webapp/assets/ace/mode-css.js
Normal file
@@ -0,0 +1,814 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = CssHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CssBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingRules = "cStyle";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = line.match(/^.*\{\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("csslint", function(e) {
|
||||||
|
session.setAnnotations(e.data);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("terminate", function() {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/css";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
|
||||||
|
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
|
||||||
|
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
|
||||||
|
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
|
||||||
|
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
|
||||||
|
|
||||||
|
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"support.function": supportFunction,
|
||||||
|
"support.constant": supportConstant,
|
||||||
|
"support.type": supportType,
|
||||||
|
"support.constant.color": supportConstantColor,
|
||||||
|
"support.constant.fonts": supportConstantFonts
|
||||||
|
}, "text", true);
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
push : "comment"
|
||||||
|
}, {
|
||||||
|
token: "paren.lparen",
|
||||||
|
regex: "\\{",
|
||||||
|
push: "ruleset"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "@.*?{",
|
||||||
|
push: "media"
|
||||||
|
}, {
|
||||||
|
token: "keyword",
|
||||||
|
regex: "#[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable",
|
||||||
|
regex: "\\.[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: ":[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
caseInsensitive: true
|
||||||
|
}],
|
||||||
|
|
||||||
|
"media" : [{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
push : "comment"
|
||||||
|
}, {
|
||||||
|
token: "paren.lparen",
|
||||||
|
regex: "\\{",
|
||||||
|
push: "ruleset"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "\\}",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
token: "keyword",
|
||||||
|
regex: "#[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable",
|
||||||
|
regex: "\\.[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: ":[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
caseInsensitive: true
|
||||||
|
}],
|
||||||
|
|
||||||
|
"comment" : [{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment"
|
||||||
|
}],
|
||||||
|
|
||||||
|
"ruleset" : [
|
||||||
|
{
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "\\}",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
push : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : ["constant.numeric", "keyword"],
|
||||||
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex6 color
|
||||||
|
regex : "#[a-f0-9]{6}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex3 color
|
||||||
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
|
}, {
|
||||||
|
token : ["support.function", "string", "support.function"],
|
||||||
|
regex : "(url\\()(.*)(\\))"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
||||||
|
}, {
|
||||||
|
caseInsensitive: true
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(CssHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.CssHighlightRules = CssHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
var CssBehaviour = function () {
|
||||||
|
|
||||||
|
this.inherit(CstyleBehaviour);
|
||||||
|
|
||||||
|
this.add("colon", "insertion", function (state, action, editor, session, text) {
|
||||||
|
if (text === ':') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
if (token && token.value.match(/\s+/)) {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
}
|
||||||
|
if (token && token.type === 'support.type') {
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === ':') {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
||||||
|
return {
|
||||||
|
text: ':;',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("colon", "deletion", function (state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected === ':') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
if (token && token.value.match(/\s+/)) {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
}
|
||||||
|
if (token && token.type === 'support.type') {
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar === ';') {
|
||||||
|
range.end.column ++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("semicolon", "insertion", function (state, action, editor, session, text) {
|
||||||
|
if (text === ';') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === ';') {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
oop.inherits(CssBehaviour, CstyleBehaviour);
|
||||||
|
|
||||||
|
exports.CssBehaviour = CssBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2396
src/main/webapp/assets/ace/mode-curly.js
Normal file
2396
src/main/webapp/assets/ace/mode-curly.js
Normal file
File diff suppressed because it is too large
Load Diff
491
src/main/webapp/assets/ace/mode-d.js
Normal file
491
src/main/webapp/assets/ace/mode-d.js
Normal file
@@ -0,0 +1,491 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/d', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/d_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = DHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "/\\+";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/d";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/d_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|"+
|
||||||
|
"typeof|typeid|sizeof|cast|new|in|is|typedef|__vector|__parameters"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordControls = (
|
||||||
|
"break|case|continue|default|do|else|for|foreach|foreach_reverse|goto|if|" +
|
||||||
|
"return|switch|while|catch|try|throw|finally|version|assert|unittest|with"
|
||||||
|
);
|
||||||
|
|
||||||
|
var types = (
|
||||||
|
"auto|bool|char|dchar|wchar|byte|ubyte|float|double|real|" +
|
||||||
|
"cfloat|creal|cdouble|cent|ifloat|ireal|idouble|" +
|
||||||
|
"int|long|short|void|uint|ulong|ushort|ucent|" +
|
||||||
|
"function|delegate|string|wstring|dstring|size_t|ptrdiff_t|hash_t|Object"
|
||||||
|
);
|
||||||
|
|
||||||
|
var modifiers = (
|
||||||
|
"abstract|align|debug|deprecated|export|extern|const|final|in|inout|out|" +
|
||||||
|
"ref|immutable|lazy|nothrow|override|package|pragma|private|protected|" +
|
||||||
|
"public|pure|scope|shared|__gshared|synchronized|static|volatile"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storages = (
|
||||||
|
"class|struct|union|template|interface|enum|macro"
|
||||||
|
);
|
||||||
|
|
||||||
|
var stringEscapesSeq = {
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv])|" +
|
||||||
|
"(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))"
|
||||||
|
};
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"null|true|false|"+
|
||||||
|
"__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__|"+
|
||||||
|
"__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__"
|
||||||
|
);
|
||||||
|
|
||||||
|
var operators = (
|
||||||
|
"/|/\\=|&|&\\=|&&|\\|\\|\\=|\\|\\||\\-|\\-\\=|\\-\\-|\\+|" +
|
||||||
|
"\\+\\=|\\+\\+|\\<|\\<\\=|\\<\\<|\\<\\<\\=|\\<\\>|\\<\\>\\=|\\>|\\>\\=|\\>\\>\\=|" +
|
||||||
|
"\\>\\>\\>\\=|\\>\\>|\\>\\>\\>|\\!|\\!\\=|\\!\\<\\>|\\!\\<\\>\\=|\\!\\<|\\!\\<\\=|" +
|
||||||
|
"\\!\\>|\\!\\>\\=|\\?|\\$|\\=|\\=\\=|\\*|\\*\\=|%|%\\=|" +
|
||||||
|
"\\^|\\^\\=|\\^\\^|\\^\\^\\=|~|~\\=|\\=\\>|#"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
||||||
|
"keyword.modifier" : modifiers,
|
||||||
|
"keyword.control" : keywordControls,
|
||||||
|
"keyword.type" : types,
|
||||||
|
"keyword": keywords,
|
||||||
|
"keyword.storage": storages,
|
||||||
|
"punctation": "\\.|\\,|;|\\.\\.|\\.\\.\\.",
|
||||||
|
"keyword.operator" : operators,
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var identifierRe = "[a-zA-Z_\u00a1-\uffff][a-zA-Z\\d_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{ //-------------------------------------------------------- COMMENTS
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "star-comment"
|
||||||
|
}, {
|
||||||
|
token: "comment.shebang",
|
||||||
|
regex: "^\s*#!.*"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\+",
|
||||||
|
next: "plus-comment"
|
||||||
|
}, { //-------------------------------------------------------- STRINGS
|
||||||
|
onMatch: function(value, currentState, state) {
|
||||||
|
state.unshift(this.next, value.substr(2));
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: 'q"(?:[\\[\\(\\{\\<]+)',
|
||||||
|
next: 'operator-heredoc-string'
|
||||||
|
}, {
|
||||||
|
onMatch: function(value, currentState, state) {
|
||||||
|
state.unshift(this.next, value.substr(2));
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: 'q"(?:[a-zA-Z_]+)$',
|
||||||
|
next: 'identifier-heredoc-string'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '[xr]?"',
|
||||||
|
next : "quote-string"
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '[xr]?`',
|
||||||
|
next : "backtick-string"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "[xr]?['](?:(?:\\\\.)|(?:[^'\\\\]))*?['][cdw]?"
|
||||||
|
}, { //-------------------------------------------------------- RULES
|
||||||
|
token: ["keyword", "text", "paren.lparen"],
|
||||||
|
regex: /(asm)(\s*)({)/,
|
||||||
|
next: "d-asm"
|
||||||
|
}, {
|
||||||
|
token: ["keyword", "text", "paren.lparen", "constant.language"],
|
||||||
|
regex: "(__traits)(\\s*)(\\()("+identifierRe+")"
|
||||||
|
}, { // import|module abc
|
||||||
|
token: ["keyword", "text", "variable.module"],
|
||||||
|
regex: "(import|module)(\\s+)((?:"+identifierRe+"\\.?)*)"
|
||||||
|
}, { // storage Name
|
||||||
|
token: ["keyword.storage", "text", "entity.name.type"],
|
||||||
|
regex: "("+storages+")(\\s*)("+identifierRe+")"
|
||||||
|
}, { // alias|typedef foo bar;
|
||||||
|
token: ["keyword", "text", "variable.storage", "text"],
|
||||||
|
regex: "(alias|typedef)(\\s*)("+identifierRe+")(\\s*)"
|
||||||
|
}, { //-------------------------------------------------------- OTHERS
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F_]+(l|ul|u|f|F|L|U|UL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d[\\d_]*(?:(?:\\.[\\d_]*)?(?:[eE][+-]?[\\d_]+)?)?(l|ul|u|f|F|L|U|UL)?\\b"
|
||||||
|
}, {
|
||||||
|
token: "entity.other.attribute-name",
|
||||||
|
regex: "@"+identifierRe
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : operators
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\.|\\:"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"star-comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: 'comment'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"plus-comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : "\\+\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: 'comment'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"quote-string" : [
|
||||||
|
stringEscapesSeq,
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '"[cdw]?',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: 'string'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"backtick-string" : [
|
||||||
|
stringEscapesSeq,
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '`[cdw]?',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: 'string'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"operator-heredoc-string": [
|
||||||
|
{
|
||||||
|
onMatch: function(value, currentState, state) {
|
||||||
|
value = value.substring(value.length-2, value.length-1);
|
||||||
|
var map = {'>':'<',']':'[',')':'(','}':'{'};
|
||||||
|
if(Object.keys(map).indexOf(value) != -1)
|
||||||
|
value = map[value];
|
||||||
|
if(value != state[1]) return "string";
|
||||||
|
state.shift();
|
||||||
|
state.shift();
|
||||||
|
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: '(?:[\\]\\)}>]+)"',
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '[^\\]\\)}>]+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"identifier-heredoc-string": [
|
||||||
|
{
|
||||||
|
onMatch: function(value, currentState, state) {
|
||||||
|
value = value.substring(0, value.length-1);
|
||||||
|
if(value != state[1]) return "string";
|
||||||
|
state.shift();
|
||||||
|
state.shift();
|
||||||
|
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: '^(?:[A-Za-z_][a-zA-Z0-9]+)"',
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '[^\\]\\)}>]+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"d-asm": [
|
||||||
|
{
|
||||||
|
token: "paren.rparen",
|
||||||
|
regex: "\\}",
|
||||||
|
next: "start"
|
||||||
|
}, {
|
||||||
|
token: 'keyword.instruction',
|
||||||
|
regex: '[a-zA-Z]+',
|
||||||
|
next: 'd-asm-instruction'
|
||||||
|
}, {
|
||||||
|
token: "text",
|
||||||
|
regex: "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'd-asm-instruction': [
|
||||||
|
{
|
||||||
|
token: 'constant.language',
|
||||||
|
regex: /AL|AH|AX|EAX|BL|BH|BX|EBX|CL|CH|CX|ECX|DL|DH|DX|EDX|BP|EBP|SP|ESP|DI|EDI|SI|ESI/i
|
||||||
|
}, {
|
||||||
|
token: 'identifier',
|
||||||
|
regex: '[a-zA-Z]+'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '".*"'
|
||||||
|
}, {
|
||||||
|
token: 'comment',
|
||||||
|
regex: '//.*$'
|
||||||
|
}, {
|
||||||
|
token: 'constant.numeric',
|
||||||
|
regex: '[0-9.xA-F]+'
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.operator',
|
||||||
|
regex: '\\,'
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.operator',
|
||||||
|
regex: ';',
|
||||||
|
next: 'd-asm'
|
||||||
|
}, {
|
||||||
|
token: 'text',
|
||||||
|
regex: '\\s+'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
DHighlightRules.metaData = {
|
||||||
|
comment: 'D language',
|
||||||
|
fileTypes: [ 'd', 'di' ],
|
||||||
|
firstLineMatch: '^#!.*\\b[glr]?dmd\\b.',
|
||||||
|
foldingStartMarker: '(?x)/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))',
|
||||||
|
foldingStopMarker: '(?<!\\*)\\*\\*/|^\\s*\\}',
|
||||||
|
keyEquivalent: '^~D',
|
||||||
|
name: 'D',
|
||||||
|
scopeName: 'source.d'
|
||||||
|
};
|
||||||
|
oop.inherits(DHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.DHighlightRules = DHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1021
src/main/webapp/assets/ace/mode-dart.js
Normal file
1021
src/main/webapp/assets/ace/mode-dart.js
Normal file
File diff suppressed because it is too large
Load Diff
169
src/main/webapp/assets/ace/mode-diff.js
Normal file
169
src/main/webapp/assets/ace/mode-diff.js
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/diff', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/diff_highlight_rules', 'ace/mode/folding/diff'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
|
||||||
|
var FoldMode = require("./folding/diff").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HighlightRules;
|
||||||
|
this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.$id = "ace/mode/diff";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/diff_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DiffHighlightRules = function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [{
|
||||||
|
regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
|
||||||
|
token: "punctuation.definition.separator.diff",
|
||||||
|
"name": "keyword"
|
||||||
|
}, { //diff.range.unified
|
||||||
|
regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
|
||||||
|
token: [
|
||||||
|
"constant",
|
||||||
|
"constant.numeric",
|
||||||
|
"constant",
|
||||||
|
"comment.doc.tag"
|
||||||
|
]
|
||||||
|
}, { //diff.range.normal
|
||||||
|
regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
|
||||||
|
token: [
|
||||||
|
"constant.numeric",
|
||||||
|
"punctuation.definition.range.diff",
|
||||||
|
"constant.function",
|
||||||
|
"constant.numeric",
|
||||||
|
"punctuation.definition.range.diff",
|
||||||
|
"invalid"
|
||||||
|
],
|
||||||
|
"name": "meta."
|
||||||
|
}, {
|
||||||
|
regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$",
|
||||||
|
token: [
|
||||||
|
"constant.numeric",
|
||||||
|
"meta.tag"
|
||||||
|
]
|
||||||
|
}, { // added
|
||||||
|
regex: "^([!+>])(.*?)(\\s*)$",
|
||||||
|
token: [
|
||||||
|
"support.constant",
|
||||||
|
"text",
|
||||||
|
"invalid"
|
||||||
|
]
|
||||||
|
}, { // removed
|
||||||
|
regex: "^([<\\-])(.*?)(\\s*)$",
|
||||||
|
token: [
|
||||||
|
"support.function",
|
||||||
|
"string",
|
||||||
|
"invalid"
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
|
||||||
|
token: ["variable", "variable", "keyword", "variable"]
|
||||||
|
}, {
|
||||||
|
regex: "^Index.+$",
|
||||||
|
token: "variable"
|
||||||
|
}, {
|
||||||
|
regex: "^\\s+$",
|
||||||
|
token: "text"
|
||||||
|
}, {
|
||||||
|
regex: "\\s*$",
|
||||||
|
token: "invalid"
|
||||||
|
}, {
|
||||||
|
defaultToken: "invisible",
|
||||||
|
caseInsensitive: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DiffHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.DiffHighlightRules = DiffHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/diff', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(levels, flag) {
|
||||||
|
this.regExpList = levels;
|
||||||
|
this.flag = flag;
|
||||||
|
this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var start = {row: row, column: line.length};
|
||||||
|
|
||||||
|
var regList = this.regExpList;
|
||||||
|
for (var i = 1; i <= regList.length; i++) {
|
||||||
|
var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
|
||||||
|
if (re.test(line))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var l = session.getLength(); ++row < l; ) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
if (re.test(line))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (row == start.row + 1)
|
||||||
|
return;
|
||||||
|
return Range.fromPoints(start, {row: row - 1, column: line.length});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
2425
src/main/webapp/assets/ace/mode-django.js
Normal file
2425
src/main/webapp/assets/ace/mode-django.js
Normal file
File diff suppressed because it is too large
Load Diff
360
src/main/webapp/assets/ace/mode-dot.js
Normal file
360
src/main/webapp/assets/ace/mode-dot.js
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
ace.define('ace/mode/dot', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/matching_brace_outdent', 'ace/mode/dot_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
|
||||||
|
var DotFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = DotHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new DotFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = ["//", "#"];
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/dot";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/dot_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/doc_comment_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
|
||||||
|
var DotHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = lang.arrayToMap(
|
||||||
|
("strict|node|edge|graph|digraph|subgraph").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var attributes = lang.arrayToMap(
|
||||||
|
("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : /\/\/.*$/
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : /#.*$/
|
||||||
|
}, {
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
merge : true,
|
||||||
|
regex : /\/\*/,
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'(?=.)",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"(?=.)',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : /\+|=|\->/
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : /,|;/
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : /[\[{]/
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : /[\]}]/
|
||||||
|
}, {
|
||||||
|
token: "comment",
|
||||||
|
regex: /^#!.*$/
|
||||||
|
}, {
|
||||||
|
token: function(value) {
|
||||||
|
if (keywords.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
return "keyword";
|
||||||
|
}
|
||||||
|
else if (attributes.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
return "variable";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "text";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
merge : true,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
merge : true,
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '[^"\\\\]+',
|
||||||
|
merge : true
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qqstring",
|
||||||
|
merge : true
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"|$',
|
||||||
|
next : "start",
|
||||||
|
merge : true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : "[^'\\\\]+",
|
||||||
|
merge : true
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qstring",
|
||||||
|
merge : true
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'|$",
|
||||||
|
next : "start",
|
||||||
|
merge : true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DotHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.DotHighlightRules = DotHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2789
src/main/webapp/assets/ace/mode-ejs.js
Normal file
2789
src/main/webapp/assets/ace/mode-ejs.js
Normal file
File diff suppressed because it is too large
Load Diff
986
src/main/webapp/assets/ace/mode-erlang.js
Normal file
986
src/main/webapp/assets/ace/mode-erlang.js
Normal file
@@ -0,0 +1,986 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/erlang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/erlang_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = ErlangHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "%";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/erlang";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/erlang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var ErlangHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { include: '#module-directive' },
|
||||||
|
{ include: '#import-export-directive' },
|
||||||
|
{ include: '#behaviour-directive' },
|
||||||
|
{ include: '#record-directive' },
|
||||||
|
{ include: '#define-directive' },
|
||||||
|
{ include: '#macro-directive' },
|
||||||
|
{ include: '#directive' },
|
||||||
|
{ include: '#function' },
|
||||||
|
{ include: '#everything-else' } ],
|
||||||
|
'#atom':
|
||||||
|
[ { token: 'punctuation.definition.symbol.begin.erlang',
|
||||||
|
regex: '\'',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.symbol.end.erlang',
|
||||||
|
regex: '\'',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.escape.erlang',
|
||||||
|
'constant.other.symbol.escape.erlang',
|
||||||
|
'punctuation.definition.escape.erlang',
|
||||||
|
'constant.other.symbol.escape.erlang',
|
||||||
|
'constant.other.symbol.escape.erlang' ],
|
||||||
|
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
||||||
|
{ token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
|
||||||
|
{ defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
|
||||||
|
{ token: 'constant.other.symbol.unquoted.erlang',
|
||||||
|
regex: '[a-z][a-zA-Z\\d@_]*' } ],
|
||||||
|
'#behaviour-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.behaviour.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.behaviour.erlang',
|
||||||
|
'keyword.control.directive.behaviour.erlang',
|
||||||
|
'meta.directive.behaviour.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.behaviour.erlang',
|
||||||
|
'entity.name.type.class.behaviour.definition.erlang',
|
||||||
|
'meta.directive.behaviour.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.behaviour.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
|
||||||
|
'#binary':
|
||||||
|
[ { token: 'punctuation.definition.binary.begin.erlang',
|
||||||
|
regex: '<<',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.binary.end.erlang',
|
||||||
|
regex: '>>',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.separator.binary.erlang',
|
||||||
|
'punctuation.separator.value-size.erlang' ],
|
||||||
|
regex: '(,)|(:)' },
|
||||||
|
{ include: '#internal-type-specifiers' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.structure.binary.erlang' } ] } ],
|
||||||
|
'#character':
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.character.erlang',
|
||||||
|
'punctuation.definition.escape.erlang',
|
||||||
|
'constant.character.escape.erlang',
|
||||||
|
'punctuation.definition.escape.erlang',
|
||||||
|
'constant.character.escape.erlang',
|
||||||
|
'constant.character.escape.erlang' ],
|
||||||
|
regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
||||||
|
{ token: 'invalid.illegal.character.erlang',
|
||||||
|
regex: '\\$\\\\\\^?.?' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.character.erlang',
|
||||||
|
'constant.character.erlang' ],
|
||||||
|
regex: '(\\$)(\\S)' },
|
||||||
|
{ token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
|
||||||
|
'#comment':
|
||||||
|
[ { token: 'punctuation.definition.comment.erlang',
|
||||||
|
regex: '%.*$',
|
||||||
|
push_:
|
||||||
|
[ { token: 'comment.line.percentage.erlang',
|
||||||
|
regex: '$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.line.percentage.erlang' } ] } ],
|
||||||
|
'#define-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.define.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'keyword.control.directive.define.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'entity.name.function.macro.definition.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'punctuation.separator.parameters.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\))(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.directive.define.erlang' } ] },
|
||||||
|
{ token: 'meta.directive.define.erlang',
|
||||||
|
regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.define.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\))(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'text',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'text',
|
||||||
|
'keyword.control.directive.define.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'text',
|
||||||
|
'entity.name.function.macro.definition.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.definition.parameters.begin.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.parameters.erlang' ],
|
||||||
|
regex: '(\\))(\\s*)(,)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ token: 'punctuation.separator.define.erlang',
|
||||||
|
regex: '\\|\\||\\||:|;|,|\\.|->' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.directive.define.erlang' } ] } ],
|
||||||
|
'#directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.erlang',
|
||||||
|
'keyword.control.directive.erlang',
|
||||||
|
'meta.directive.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\)?)(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.directive.erlang' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.directive.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.erlang',
|
||||||
|
'keyword.control.directive.erlang',
|
||||||
|
'meta.directive.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
|
||||||
|
'#everything-else':
|
||||||
|
[ { include: '#comment' },
|
||||||
|
{ include: '#record-usage' },
|
||||||
|
{ include: '#macro-usage' },
|
||||||
|
{ include: '#expression' },
|
||||||
|
{ include: '#keyword' },
|
||||||
|
{ include: '#textual-operator' },
|
||||||
|
{ include: '#function-call' },
|
||||||
|
{ include: '#tuple' },
|
||||||
|
{ include: '#list' },
|
||||||
|
{ include: '#binary' },
|
||||||
|
{ include: '#parenthesized-expression' },
|
||||||
|
{ include: '#character' },
|
||||||
|
{ include: '#number' },
|
||||||
|
{ include: '#atom' },
|
||||||
|
{ include: '#string' },
|
||||||
|
{ include: '#symbolic-operator' },
|
||||||
|
{ include: '#variable' } ],
|
||||||
|
'#expression':
|
||||||
|
[ { token: 'keyword.control.if.erlang',
|
||||||
|
regex: '\\bif\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-expression-punctuation' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.if.erlang' } ] },
|
||||||
|
{ token: 'keyword.control.case.erlang',
|
||||||
|
regex: '\\bcase\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-expression-punctuation' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.case.erlang' } ] },
|
||||||
|
{ token: 'keyword.control.receive.erlang',
|
||||||
|
regex: '\\breceive\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-expression-punctuation' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.receive.erlang' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.control.fun.erlang',
|
||||||
|
'text',
|
||||||
|
'entity.name.type.class.module.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.module-function.erlang',
|
||||||
|
'text',
|
||||||
|
'entity.name.function.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.function-arity.erlang' ],
|
||||||
|
regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
|
||||||
|
{ token: 'keyword.control.fun.erlang',
|
||||||
|
regex: '\\bfun\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'text',
|
||||||
|
regex: '(?=\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.separator.clauses.erlang',
|
||||||
|
regex: ';|(?=\\bend\\b)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-function-parts' } ] },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.fun.erlang' } ] },
|
||||||
|
{ token: 'keyword.control.try.erlang',
|
||||||
|
regex: '\\btry\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-expression-punctuation' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.try.erlang' } ] },
|
||||||
|
{ token: 'keyword.control.begin.erlang',
|
||||||
|
regex: '\\bbegin\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-expression-punctuation' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.begin.erlang' } ] },
|
||||||
|
{ token: 'keyword.control.query.erlang',
|
||||||
|
regex: '\\bquery\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.control.end.erlang',
|
||||||
|
regex: '\\bend\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.query.erlang' } ] } ],
|
||||||
|
'#function':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.function.erlang',
|
||||||
|
'entity.name.function.definition.erlang',
|
||||||
|
'meta.function.erlang' ],
|
||||||
|
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.terminator.function.erlang',
|
||||||
|
regex: '\\.',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: [ 'text', 'entity.name.function.erlang', 'text' ],
|
||||||
|
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
|
||||||
|
{ token: 'text',
|
||||||
|
regex: '(?=\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.separator.clauses.erlang',
|
||||||
|
regex: ';|(?=\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#parenthesized-expression' },
|
||||||
|
{ include: '#internal-function-parts' } ] },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.function.erlang' } ] } ],
|
||||||
|
'#function-call':
|
||||||
|
[ { token: 'meta.function-call.erlang',
|
||||||
|
regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.parameters.end.erlang',
|
||||||
|
regex: '\\)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'entity.name.type.class.module.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.module-function.erlang',
|
||||||
|
'text',
|
||||||
|
'entity.name.function.guard.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.definition.parameters.begin.erlang' ],
|
||||||
|
regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'entity.name.type.class.module.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.module-function.erlang',
|
||||||
|
'text',
|
||||||
|
'entity.name.function.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.definition.parameters.begin.erlang' ],
|
||||||
|
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ defaultToken: 'meta.function-call.erlang' } ] } ],
|
||||||
|
'#import-export-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.import.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.import.erlang',
|
||||||
|
'keyword.control.directive.import.erlang',
|
||||||
|
'meta.directive.import.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.import.erlang',
|
||||||
|
'entity.name.type.class.module.erlang',
|
||||||
|
'meta.directive.import.erlang',
|
||||||
|
'punctuation.separator.parameters.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.import.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\))(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-function-list' },
|
||||||
|
{ defaultToken: 'meta.directive.import.erlang' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.directive.export.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.export.erlang',
|
||||||
|
'keyword.control.directive.export.erlang',
|
||||||
|
'meta.directive.export.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.export.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\))(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-function-list' },
|
||||||
|
{ defaultToken: 'meta.directive.export.erlang' } ] } ],
|
||||||
|
'#internal-expression-punctuation':
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.separator.clause-head-body.erlang',
|
||||||
|
'punctuation.separator.clauses.erlang',
|
||||||
|
'punctuation.separator.expressions.erlang' ],
|
||||||
|
regex: '(->)|(;)|(,)' } ],
|
||||||
|
'#internal-function-list':
|
||||||
|
[ { token: 'punctuation.definition.list.begin.erlang',
|
||||||
|
regex: '\\[',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.list.end.erlang',
|
||||||
|
regex: '\\]',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'entity.name.function.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.function-arity.erlang' ],
|
||||||
|
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.separator.list.erlang',
|
||||||
|
regex: ',|(?=\\])',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.structure.list.function.erlang' } ] } ],
|
||||||
|
'#internal-function-parts':
|
||||||
|
[ { token: 'text',
|
||||||
|
regex: '(?=\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.separator.clause-head-body.erlang',
|
||||||
|
regex: '->',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'punctuation.definition.parameters.begin.erlang',
|
||||||
|
regex: '\\(',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.parameters.end.erlang',
|
||||||
|
regex: '\\)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ token: 'punctuation.separator.guards.erlang', regex: ',|;' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ token: 'punctuation.separator.expressions.erlang',
|
||||||
|
regex: ',' },
|
||||||
|
{ include: '#everything-else' } ],
|
||||||
|
'#internal-record-body':
|
||||||
|
[ { token: 'punctuation.definition.class.record.begin.erlang',
|
||||||
|
regex: '\\{',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.structure.record.erlang',
|
||||||
|
regex: '(?=\\})',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'variable.other.field.erlang',
|
||||||
|
'variable.language.omitted.field.erlang',
|
||||||
|
'text',
|
||||||
|
'keyword.operator.assignment.erlang' ],
|
||||||
|
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.separator.class.record.erlang',
|
||||||
|
regex: ',|(?=\\})',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'variable.other.field.erlang',
|
||||||
|
'text',
|
||||||
|
'punctuation.separator.class.record.erlang' ],
|
||||||
|
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.structure.record.erlang' } ] } ],
|
||||||
|
'#internal-type-specifiers':
|
||||||
|
[ { token: 'punctuation.separator.value-type.erlang',
|
||||||
|
regex: '/',
|
||||||
|
push:
|
||||||
|
[ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'storage.type.erlang',
|
||||||
|
'storage.modifier.signedness.erlang',
|
||||||
|
'storage.modifier.endianness.erlang',
|
||||||
|
'storage.modifier.unit.erlang',
|
||||||
|
'punctuation.separator.type-specifiers.erlang' ],
|
||||||
|
regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
|
||||||
|
'#keyword':
|
||||||
|
[ { token: 'keyword.control.erlang',
|
||||||
|
regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
|
||||||
|
'#list':
|
||||||
|
[ { token: 'punctuation.definition.list.begin.erlang',
|
||||||
|
regex: '\\[',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.list.end.erlang',
|
||||||
|
regex: '\\]',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.list.erlang',
|
||||||
|
regex: '\\||\\|\\||,' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.structure.list.erlang' } ] } ],
|
||||||
|
'#macro-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.ifdef.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.ifdef.erlang',
|
||||||
|
'keyword.control.directive.ifdef.erlang',
|
||||||
|
'meta.directive.ifdef.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.ifdef.erlang',
|
||||||
|
'entity.name.function.macro.erlang',
|
||||||
|
'meta.directive.ifdef.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.ifdef.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.directive.ifndef.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.ifndef.erlang',
|
||||||
|
'keyword.control.directive.ifndef.erlang',
|
||||||
|
'meta.directive.ifndef.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.ifndef.erlang',
|
||||||
|
'entity.name.function.macro.erlang',
|
||||||
|
'meta.directive.ifndef.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.ifndef.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.directive.undef.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.undef.erlang',
|
||||||
|
'keyword.control.directive.undef.erlang',
|
||||||
|
'meta.directive.undef.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.undef.erlang',
|
||||||
|
'entity.name.function.macro.erlang',
|
||||||
|
'meta.directive.undef.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.undef.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
|
||||||
|
'#macro-usage':
|
||||||
|
[ { token:
|
||||||
|
[ 'keyword.operator.macro.erlang',
|
||||||
|
'meta.macro-usage.erlang',
|
||||||
|
'entity.name.function.macro.erlang' ],
|
||||||
|
regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
|
||||||
|
'#module-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.module.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.module.erlang',
|
||||||
|
'keyword.control.directive.module.erlang',
|
||||||
|
'meta.directive.module.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.module.erlang',
|
||||||
|
'entity.name.type.class.module.definition.erlang',
|
||||||
|
'meta.directive.module.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.module.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
|
||||||
|
'#number':
|
||||||
|
[ { token: 'text',
|
||||||
|
regex: '(?=\\d)',
|
||||||
|
push:
|
||||||
|
[ { token: 'text', regex: '(?!\\d)', next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.float.erlang',
|
||||||
|
'punctuation.separator.integer-float.erlang',
|
||||||
|
'constant.numeric.float.erlang',
|
||||||
|
'punctuation.separator.float-exponent.erlang' ],
|
||||||
|
regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.binary.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.binary.erlang' ],
|
||||||
|
regex: '(2)(#)([0-1]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-3.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-3.erlang' ],
|
||||||
|
regex: '(3)(#)([0-2]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-4.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-4.erlang' ],
|
||||||
|
regex: '(4)(#)([0-3]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-5.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-5.erlang' ],
|
||||||
|
regex: '(5)(#)([0-4]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-6.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-6.erlang' ],
|
||||||
|
regex: '(6)(#)([0-5]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-7.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-7.erlang' ],
|
||||||
|
regex: '(7)(#)([0-6]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.octal.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.octal.erlang' ],
|
||||||
|
regex: '(8)(#)([0-7]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-9.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-9.erlang' ],
|
||||||
|
regex: '(9)(#)([0-8]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.decimal.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.decimal.erlang' ],
|
||||||
|
regex: '(10)(#)(\\d+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-11.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-11.erlang' ],
|
||||||
|
regex: '(11)(#)([\\daA]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-12.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-12.erlang' ],
|
||||||
|
regex: '(12)(#)([\\da-bA-B]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-13.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-13.erlang' ],
|
||||||
|
regex: '(13)(#)([\\da-cA-C]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-14.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-14.erlang' ],
|
||||||
|
regex: '(14)(#)([\\da-dA-D]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-15.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-15.erlang' ],
|
||||||
|
regex: '(15)(#)([\\da-eA-E]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.hexadecimal.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.hexadecimal.erlang' ],
|
||||||
|
regex: '(16)(#)([\\da-fA-F]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-17.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-17.erlang' ],
|
||||||
|
regex: '(17)(#)([\\da-gA-G]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-18.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-18.erlang' ],
|
||||||
|
regex: '(18)(#)([\\da-hA-H]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-19.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-19.erlang' ],
|
||||||
|
regex: '(19)(#)([\\da-iA-I]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-20.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-20.erlang' ],
|
||||||
|
regex: '(20)(#)([\\da-jA-J]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-21.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-21.erlang' ],
|
||||||
|
regex: '(21)(#)([\\da-kA-K]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-22.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-22.erlang' ],
|
||||||
|
regex: '(22)(#)([\\da-lA-L]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-23.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-23.erlang' ],
|
||||||
|
regex: '(23)(#)([\\da-mA-M]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-24.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-24.erlang' ],
|
||||||
|
regex: '(24)(#)([\\da-nA-N]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-25.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-25.erlang' ],
|
||||||
|
regex: '(25)(#)([\\da-oA-O]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-26.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-26.erlang' ],
|
||||||
|
regex: '(26)(#)([\\da-pA-P]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-27.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-27.erlang' ],
|
||||||
|
regex: '(27)(#)([\\da-qA-Q]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-28.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-28.erlang' ],
|
||||||
|
regex: '(28)(#)([\\da-rA-R]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-29.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-29.erlang' ],
|
||||||
|
regex: '(29)(#)([\\da-sA-S]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-30.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-30.erlang' ],
|
||||||
|
regex: '(30)(#)([\\da-tA-T]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-31.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-31.erlang' ],
|
||||||
|
regex: '(31)(#)([\\da-uA-U]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-32.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-32.erlang' ],
|
||||||
|
regex: '(32)(#)([\\da-vA-V]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-33.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-33.erlang' ],
|
||||||
|
regex: '(33)(#)([\\da-wA-W]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-34.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-34.erlang' ],
|
||||||
|
regex: '(34)(#)([\\da-xA-X]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-35.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-35.erlang' ],
|
||||||
|
regex: '(35)(#)([\\da-yA-Y]+)' },
|
||||||
|
{ token:
|
||||||
|
[ 'constant.numeric.integer.base-36.erlang',
|
||||||
|
'punctuation.separator.base-integer.erlang',
|
||||||
|
'constant.numeric.integer.base-36.erlang' ],
|
||||||
|
regex: '(36)(#)([\\da-zA-Z]+)' },
|
||||||
|
{ token: 'invalid.illegal.integer.erlang',
|
||||||
|
regex: '\\d+#[\\da-zA-Z]+' },
|
||||||
|
{ token: 'constant.numeric.integer.decimal.erlang',
|
||||||
|
regex: '\\d+' } ] } ],
|
||||||
|
'#parenthesized-expression':
|
||||||
|
[ { token: 'punctuation.section.expression.begin.erlang',
|
||||||
|
regex: '\\(',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.section.expression.end.erlang',
|
||||||
|
regex: '\\)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.expression.parenthesized' } ] } ],
|
||||||
|
'#record-directive':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.directive.record.erlang',
|
||||||
|
'punctuation.section.directive.begin.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'keyword.control.directive.import.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'punctuation.definition.parameters.begin.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'entity.name.type.class.record.definition.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'punctuation.separator.parameters.erlang' ],
|
||||||
|
regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
|
||||||
|
push:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.class.record.end.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'punctuation.definition.parameters.end.erlang',
|
||||||
|
'meta.directive.record.erlang',
|
||||||
|
'punctuation.section.directive.end.erlang' ],
|
||||||
|
regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-record-body' },
|
||||||
|
{ defaultToken: 'meta.directive.record.erlang' } ] } ],
|
||||||
|
'#record-usage':
|
||||||
|
[ { token:
|
||||||
|
[ 'keyword.operator.record.erlang',
|
||||||
|
'meta.record-usage.erlang',
|
||||||
|
'entity.name.type.class.record.erlang',
|
||||||
|
'meta.record-usage.erlang',
|
||||||
|
'punctuation.separator.record-field.erlang',
|
||||||
|
'meta.record-usage.erlang',
|
||||||
|
'variable.other.field.erlang' ],
|
||||||
|
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
|
||||||
|
{ token:
|
||||||
|
[ 'keyword.operator.record.erlang',
|
||||||
|
'meta.record-usage.erlang',
|
||||||
|
'entity.name.type.class.record.erlang' ],
|
||||||
|
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.class.record.end.erlang',
|
||||||
|
regex: '\\}',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#internal-record-body' },
|
||||||
|
{ defaultToken: 'meta.record-usage.erlang' } ] } ],
|
||||||
|
'#string':
|
||||||
|
[ { token: 'punctuation.definition.string.begin.erlang',
|
||||||
|
regex: '"',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.erlang',
|
||||||
|
regex: '"',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.escape.erlang',
|
||||||
|
'constant.character.escape.erlang',
|
||||||
|
'punctuation.definition.escape.erlang',
|
||||||
|
'constant.character.escape.erlang',
|
||||||
|
'constant.character.escape.erlang' ],
|
||||||
|
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
|
||||||
|
{ token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.placeholder.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'constant.other.placeholder.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'constant.other.placeholder.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'constant.other.placeholder.erlang',
|
||||||
|
'constant.other.placeholder.erlang' ],
|
||||||
|
regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.placeholder.erlang',
|
||||||
|
'punctuation.separator.placeholder-parts.erlang',
|
||||||
|
'constant.other.placeholder.erlang',
|
||||||
|
'constant.other.placeholder.erlang' ],
|
||||||
|
regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
|
||||||
|
{ token: 'invalid.illegal.string.erlang', regex: '~.?' },
|
||||||
|
{ defaultToken: 'string.quoted.double.erlang' } ] } ],
|
||||||
|
'#symbolic-operator':
|
||||||
|
[ { token: 'keyword.operator.symbolic.erlang',
|
||||||
|
regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
|
||||||
|
'#textual-operator':
|
||||||
|
[ { token: 'keyword.operator.textual.erlang',
|
||||||
|
regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
|
||||||
|
'#tuple':
|
||||||
|
[ { token: 'punctuation.definition.tuple.begin.erlang',
|
||||||
|
regex: '\\{',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.tuple.end.erlang',
|
||||||
|
regex: '\\}',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'punctuation.separator.tuple.erlang', regex: ',' },
|
||||||
|
{ include: '#everything-else' },
|
||||||
|
{ defaultToken: 'meta.structure.tuple.erlang' } ] } ],
|
||||||
|
'#variable':
|
||||||
|
[ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
|
||||||
|
regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp',
|
||||||
|
fileTypes: [ 'erl', 'hrl' ],
|
||||||
|
keyEquivalent: '^~E',
|
||||||
|
name: 'Erlang',
|
||||||
|
scopeName: 'source.erlang' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(ErlangHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ErlangHighlightRules = ErlangHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
279
src/main/webapp/assets/ace/mode-forth.js
Normal file
279
src/main/webapp/assets/ace/mode-forth.js
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/forth', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/forth_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = ForthHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/forth";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/forth_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var ForthHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start: [ { include: '#forth' } ],
|
||||||
|
'#comment':
|
||||||
|
[ { token: 'comment.line.double-dash.forth',
|
||||||
|
regex: '(?:^|\\s)--\\s.*$',
|
||||||
|
comment: 'line comments for iForth' },
|
||||||
|
{ token: 'comment.line.backslash.forth',
|
||||||
|
regex: '(?:^|\\s)\\\\[\\s\\S]*$',
|
||||||
|
comment: 'ANSI line comment' },
|
||||||
|
{ token: 'comment.line.backslash-g.forth',
|
||||||
|
regex: '(?:^|\\s)\\\\[Gg] .*$',
|
||||||
|
comment: 'gForth line comment' },
|
||||||
|
{ token: 'comment.block.forth',
|
||||||
|
regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
|
||||||
|
push:
|
||||||
|
[ { token: 'comment.block.forth',
|
||||||
|
regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block.forth' } ],
|
||||||
|
comment: 'multiline comments for iForth' },
|
||||||
|
{ token: 'comment.block.documentation.forth',
|
||||||
|
regex: '\\bDOC\\b',
|
||||||
|
caseInsensitive: true,
|
||||||
|
push:
|
||||||
|
[ { token: 'comment.block.documentation.forth',
|
||||||
|
regex: '\\bENDDOC\\b',
|
||||||
|
caseInsensitive: true,
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block.documentation.forth' } ],
|
||||||
|
comment: 'documentation comments for iForth' },
|
||||||
|
{ token: 'comment.line.parentheses.forth',
|
||||||
|
regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
|
||||||
|
comment: 'ANSI line comment' } ],
|
||||||
|
'#constant':
|
||||||
|
[ { token: 'constant.language.forth',
|
||||||
|
regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'constant.numeric.forth',
|
||||||
|
regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)'},
|
||||||
|
{ token: 'constant.character.forth',
|
||||||
|
regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)'}],
|
||||||
|
'#forth':
|
||||||
|
[ { include: '#constant' },
|
||||||
|
{ include: '#comment' },
|
||||||
|
{ include: '#string' },
|
||||||
|
{ include: '#word' },
|
||||||
|
{ include: '#variable' },
|
||||||
|
{ include: '#storage' },
|
||||||
|
{ include: '#word-def' } ],
|
||||||
|
'#storage':
|
||||||
|
[ { token: 'storage.type.forth',
|
||||||
|
regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
|
||||||
|
caseInsensitive: true}],
|
||||||
|
'#string':
|
||||||
|
[ { token: 'string.quoted.double.forth',
|
||||||
|
regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'string.unquoted.forth',
|
||||||
|
regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
|
||||||
|
caseInsensitive: true}],
|
||||||
|
'#variable':
|
||||||
|
[ { token: 'variable.language.forth',
|
||||||
|
regex: '\\b(?:I|J)\\b',
|
||||||
|
caseInsensitive: true } ],
|
||||||
|
'#word':
|
||||||
|
[ { token: 'keyword.control.immediate.forth',
|
||||||
|
regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'keyword.other.immediate.forth',
|
||||||
|
regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'keyword.control.compile-only.forth',
|
||||||
|
regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'keyword.other.compile-only.forth',
|
||||||
|
regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'keyword.other.non-immediate.forth',
|
||||||
|
regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
|
||||||
|
caseInsensitive: true},
|
||||||
|
{ token: 'keyword.other.warning.forth',
|
||||||
|
regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
|
||||||
|
caseInsensitive: true}],
|
||||||
|
'#word-def':
|
||||||
|
[ { token:
|
||||||
|
[ 'keyword.other.compile-only.forth',
|
||||||
|
'keyword.other.compile-only.forth',
|
||||||
|
'meta.block.forth',
|
||||||
|
'entity.name.function.forth' ],
|
||||||
|
regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
|
||||||
|
caseInsensitive: true,
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.other.compile-only.forth',
|
||||||
|
regex: ';(?:CODE)?',
|
||||||
|
caseInsensitive: true,
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#constant' },
|
||||||
|
{ include: '#comment' },
|
||||||
|
{ include: '#string' },
|
||||||
|
{ include: '#word' },
|
||||||
|
{ include: '#variable' },
|
||||||
|
{ include: '#storage' },
|
||||||
|
{ defaultToken: 'meta.block.forth' } ] } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr' ],
|
||||||
|
foldingStartMarker: '/\\*\\*|\\{\\s*$',
|
||||||
|
foldingStopMarker: '\\*\\*/|^\\s*\\}',
|
||||||
|
keyEquivalent: '^~F',
|
||||||
|
name: 'Forth',
|
||||||
|
scopeName: 'source.forth' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(ForthHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ForthHighlightRules = ForthHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1001
src/main/webapp/assets/ace/mode-ftl.js
Normal file
1001
src/main/webapp/assets/ace/mode-ftl.js
Normal file
File diff suppressed because it is too large
Load Diff
159
src/main/webapp/assets/ace/mode-gherkin.js
Normal file
159
src/main/webapp/assets/ace/mode-gherkin.js
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/gherkin', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/gherkin_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var GherkinHighlightRules = require("./gherkin_highlight_rules").GherkinHighlightRules;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = GherkinHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.$id = "ace/mode/gherkin";
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var space2 = " ";
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
console.log(state)
|
||||||
|
|
||||||
|
if(line.match("[ ]*\\|")) {
|
||||||
|
indent += "| ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
if (line.match("Scenario:|Feature:|Scenario\ Outline:|Background:")) {
|
||||||
|
indent += space2;
|
||||||
|
} else if(line.match("(Given|Then).+(:)$|Examples:")) {
|
||||||
|
indent += space2;
|
||||||
|
} else if(line.match("\\*.+")) {
|
||||||
|
indent += "* ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/gherkin_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
|
||||||
|
|
||||||
|
var GherkinHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
start : [{
|
||||||
|
token: 'constant.numeric',
|
||||||
|
regex: "(?:(?:[1-9]\\d*)|(?:0))"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*$"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line """ string start
|
||||||
|
regex : '"{3}',
|
||||||
|
next : "qqstring3"
|
||||||
|
}, {
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '"',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "@[A-Za-z0-9]+",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "<.+>"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\| ",
|
||||||
|
next : "table-item"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\|$",
|
||||||
|
next : "start"
|
||||||
|
}],
|
||||||
|
"qqstring3" : [ {
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : stringEscape
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line """ string end
|
||||||
|
regex : '"{3}',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "string"
|
||||||
|
}],
|
||||||
|
"qqstring" : [{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : stringEscape
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"|$',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}],
|
||||||
|
"table-item" : [{
|
||||||
|
token : "string",
|
||||||
|
regex : "[A-Za-z0-9 ]*",
|
||||||
|
next : "start"
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
oop.inherits(GherkinHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.GherkinHighlightRules = GherkinHighlightRules;
|
||||||
|
});
|
||||||
892
src/main/webapp/assets/ace/mode-glsl.js
Normal file
892
src/main/webapp/assets/ace/mode-glsl.js
Normal file
@@ -0,0 +1,892 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/glsl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/mode/glsl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var CMode = require("./c_cpp").Mode;
|
||||||
|
var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = glslHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, CMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.$id = "ace/mode/glsl";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = c_cppHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
} else if (state == "doc-start") {
|
||||||
|
if (endState == "start") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var match = line.match(/^\s*(\/?)\*/);
|
||||||
|
if (match) {
|
||||||
|
if (match[1]) {
|
||||||
|
indent += " ";
|
||||||
|
}
|
||||||
|
indent += "* ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/c_cpp";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
|
||||||
|
|
||||||
|
var c_cppHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordControls = (
|
||||||
|
"break|case|continue|default|do|else|for|goto|if|_Pragma|" +
|
||||||
|
"return|switch|while|catch|operator|try|throw|using"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageType = (
|
||||||
|
"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
|
||||||
|
"_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
|
||||||
|
"class|wchar_t|template"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageModifiers = (
|
||||||
|
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
||||||
|
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordOperators = (
|
||||||
|
"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
|
||||||
|
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"NULL|true|false|TRUE|FALSE"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
||||||
|
"keyword.control" : keywordControls,
|
||||||
|
"storage.type" : storageType,
|
||||||
|
"storage.modifier" : storageModifiers,
|
||||||
|
"keyword.operator" : keywordOperators,
|
||||||
|
"variable.language": "this",
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '["].*\\\\$',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : "['].*\\\\$",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // pre-compiler directives
|
||||||
|
regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
|
||||||
|
next : "directive"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // special case pre-compiler directive
|
||||||
|
regex : "(?:#\\s*endif)\\b"
|
||||||
|
}, {
|
||||||
|
token : "support.function.C99.c",
|
||||||
|
regex : cFunctions
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directive" : [
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /.*\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : "\\s*<.+?>",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : /[^\\\/]+/,
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/glsl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||||
|
|
||||||
|
var glslHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"attribute|const|uniform|varying|break|continue|do|for|while|" +
|
||||||
|
"if|else|in|out|inout|float|int|void|bool|true|false|" +
|
||||||
|
"lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
|
||||||
|
"mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
|
||||||
|
"samplerCube|struct"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = (
|
||||||
|
"radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
|
||||||
|
"exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
|
||||||
|
"min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
|
||||||
|
"normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
|
||||||
|
"lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" +
|
||||||
|
"not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" +
|
||||||
|
"texture2DProjLod|textureCube|textureCubeLod|" +
|
||||||
|
"gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" +
|
||||||
|
"gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" +
|
||||||
|
"gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" +
|
||||||
|
"gl_DepthRangeParameters|gl_DepthRange|" +
|
||||||
|
"gl_Position|gl_PointSize|" +
|
||||||
|
"gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language": "this",
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = new c_cppHighlightRules().$rules;
|
||||||
|
this.$rules.start.forEach(function(rule) {
|
||||||
|
if (typeof rule.token == "function")
|
||||||
|
rule.token = keywordMapper;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(glslHighlightRules, c_cppHighlightRules);
|
||||||
|
|
||||||
|
exports.glslHighlightRules = glslHighlightRules;
|
||||||
|
});
|
||||||
703
src/main/webapp/assets/ace/mode-golang.js
Normal file
703
src/main/webapp/assets/ace/mode-golang.js
Normal file
@@ -0,0 +1,703 @@
|
|||||||
|
ace.define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = GolangHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};//end getNextLineIndent
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/golang";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var GolangHighlightRules = function() {
|
||||||
|
var keywords = (
|
||||||
|
"else|break|case|return|goto|if|const|select|" +
|
||||||
|
"continue|struct|default|switch|for|range|" +
|
||||||
|
"func|import|package|chan|defer|fallthrough|go|interface|map|range|" +
|
||||||
|
"select|type|var"
|
||||||
|
);
|
||||||
|
var builtinTypes = (
|
||||||
|
"string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" +
|
||||||
|
"float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error"
|
||||||
|
);
|
||||||
|
var builtinFunctions = (
|
||||||
|
"make|close|new|panic|recover"
|
||||||
|
);
|
||||||
|
var builtinConstants = ("nil|true|false|iota");
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": builtinConstants,
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"support.type": builtinTypes
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '[`](?:[^`]*)[`]'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
merge : true,
|
||||||
|
regex : '[`](?:[^`]*)$',
|
||||||
|
next : "bqstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // rune
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^="
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token: "invalid",
|
||||||
|
regex: "\\s+$"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '(?:[^`]*)`',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
oop.inherits(GolangHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.GolangHighlightRules = GolangHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1123
src/main/webapp/assets/ace/mode-groovy.js
Normal file
1123
src/main/webapp/assets/ace/mode-groovy.js
Normal file
File diff suppressed because it is too large
Load Diff
497
src/main/webapp/assets/ace/mode-haml.js
Normal file
497
src/main/webapp/assets/ace/mode-haml.js
Normal file
@@ -0,0 +1,497 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Garen J. Torikian < gjtorikian AT gmail DOT com >
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/haml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/haml_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HamlHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = ["//", "#"];
|
||||||
|
|
||||||
|
this.$id = "ace/mode/haml";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});ace.define('ace/mode/haml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/ruby_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var RubyExports = require("./ruby_highlight_rules");
|
||||||
|
var RubyHighlightRules = RubyExports.RubyHighlightRules;
|
||||||
|
|
||||||
|
var HamlHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules =
|
||||||
|
{
|
||||||
|
"start": [
|
||||||
|
{
|
||||||
|
token : "punctuation.section.comment",
|
||||||
|
regex : /^\s*\/.*/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "punctuation.section.comment",
|
||||||
|
regex : /^\s*#.*/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "string.quoted.double",
|
||||||
|
regex: "==.+?=="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "keyword.other.doctype",
|
||||||
|
regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
|
||||||
|
},
|
||||||
|
RubyExports.qString,
|
||||||
|
RubyExports.qqString,
|
||||||
|
RubyExports.tString,
|
||||||
|
{
|
||||||
|
token: ["entity.name.tag.haml"],
|
||||||
|
regex: /^\s*%[\w:]+/,
|
||||||
|
next: "tag_single"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: [ "meta.escape.haml" ],
|
||||||
|
regex: "^\\s*\\\\."
|
||||||
|
},
|
||||||
|
RubyExports.constantNumericHex,
|
||||||
|
RubyExports.constantNumericFloat,
|
||||||
|
|
||||||
|
RubyExports.constantOtherSymbol,
|
||||||
|
{
|
||||||
|
token: "text",
|
||||||
|
regex: "=|-|~",
|
||||||
|
next: "embedded_ruby"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tag_single": [
|
||||||
|
{
|
||||||
|
token: "entity.other.attribute-name.class.haml",
|
||||||
|
regex: "\\.[\\w-]+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "entity.other.attribute-name.id.haml",
|
||||||
|
regex: "#[\\w-]+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "punctuation.section",
|
||||||
|
regex: "\\{",
|
||||||
|
next: "section"
|
||||||
|
},
|
||||||
|
|
||||||
|
RubyExports.constantOtherSymbol,
|
||||||
|
|
||||||
|
{
|
||||||
|
token: "text",
|
||||||
|
regex: /\s/,
|
||||||
|
next: "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "empty",
|
||||||
|
regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/)",
|
||||||
|
next: "start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"section": [
|
||||||
|
RubyExports.constantOtherSymbol,
|
||||||
|
|
||||||
|
RubyExports.qString,
|
||||||
|
RubyExports.qqString,
|
||||||
|
RubyExports.tString,
|
||||||
|
|
||||||
|
RubyExports.constantNumericHex,
|
||||||
|
RubyExports.constantNumericFloat,
|
||||||
|
{
|
||||||
|
token: "punctuation.section",
|
||||||
|
regex: "\\}",
|
||||||
|
next: "start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"embedded_ruby": [
|
||||||
|
RubyExports.constantNumericHex,
|
||||||
|
RubyExports.constantNumericFloat,
|
||||||
|
{
|
||||||
|
token : "support.class", // class name
|
||||||
|
regex : "[A-Z][a-zA-Z_\\d]+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : new RubyHighlightRules().getKeywords(),
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : ["keyword", "text", "text"],
|
||||||
|
regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : ["text"],
|
||||||
|
regex : "^$",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : ["text"],
|
||||||
|
regex : "^(?!.*\\|\\s*$)",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(HamlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.HamlHighlightRules = HamlHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var constantOtherSymbol = exports.constantOtherSymbol = {
|
||||||
|
token : "constant.other.symbol.ruby", // symbol
|
||||||
|
regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
|
||||||
|
};
|
||||||
|
|
||||||
|
var qString = exports.qString = {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
};
|
||||||
|
|
||||||
|
var qqString = exports.qqString = {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
};
|
||||||
|
|
||||||
|
var tString = exports.tString = {
|
||||||
|
token : "string", // backtick string
|
||||||
|
regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
|
||||||
|
};
|
||||||
|
|
||||||
|
var constantNumericHex = exports.constantNumericHex = {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
|
||||||
|
};
|
||||||
|
|
||||||
|
var constantNumericFloat = exports.constantNumericFloat = {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
};
|
||||||
|
|
||||||
|
var RubyHighlightRules = function() {
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
|
||||||
|
"assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
|
||||||
|
"assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
|
||||||
|
"assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
|
||||||
|
"assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
|
||||||
|
"assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
|
||||||
|
"attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
|
||||||
|
"caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
|
||||||
|
"exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
|
||||||
|
"gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
|
||||||
|
"link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
|
||||||
|
"p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
|
||||||
|
"raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
|
||||||
|
"set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
|
||||||
|
"throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
|
||||||
|
"render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
|
||||||
|
"content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
|
||||||
|
"fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
|
||||||
|
"time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
|
||||||
|
"select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
|
||||||
|
"file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
|
||||||
|
"protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
|
||||||
|
"send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
|
||||||
|
"validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
|
||||||
|
"validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
|
||||||
|
"authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
|
||||||
|
"filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
|
||||||
|
"translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
|
||||||
|
"cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
|
||||||
|
"has_many|has_one|belongs_to|has_and_belongs_to_many"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
|
||||||
|
"__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
|
||||||
|
"redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = (
|
||||||
|
"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
|
||||||
|
"RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinVariables = (
|
||||||
|
"\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
|
||||||
|
"$!|root_url|flash|session|cookies|params|request|response|logger|self"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants,
|
||||||
|
"variable.language": builtinVariables,
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*$"
|
||||||
|
}, {
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "^=begin(?:$|\\s.*$)",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string.regexp",
|
||||||
|
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||||
|
},
|
||||||
|
|
||||||
|
qString,
|
||||||
|
qqString,
|
||||||
|
tString,
|
||||||
|
|
||||||
|
{
|
||||||
|
token : "text", // namespaces aren't symbols
|
||||||
|
regex : "::"
|
||||||
|
}, {
|
||||||
|
token : "variable.instance", // instance variable
|
||||||
|
regex : "@{1,2}[a-zA-Z_\\d]+"
|
||||||
|
}, {
|
||||||
|
token : "support.class", // class name
|
||||||
|
regex : "[A-Z][a-zA-Z_\\d]+"
|
||||||
|
},
|
||||||
|
|
||||||
|
constantOtherSymbol,
|
||||||
|
constantNumericHex,
|
||||||
|
constantNumericFloat,
|
||||||
|
|
||||||
|
{
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.separator.key-value",
|
||||||
|
regex : "=>"
|
||||||
|
}, {
|
||||||
|
stateName: "heredoc",
|
||||||
|
onMatch : function(value, currentState, stack) {
|
||||||
|
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
|
||||||
|
var tokens = value.split(this.splitRegex);
|
||||||
|
stack.push(next, tokens[3]);
|
||||||
|
return [
|
||||||
|
{type:"constant", value: tokens[1]},
|
||||||
|
{type:"string", value: tokens[2]},
|
||||||
|
{type:"support.class", value: tokens[3]},
|
||||||
|
{type:"string", value: tokens[4]}
|
||||||
|
];
|
||||||
|
},
|
||||||
|
regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
|
||||||
|
rules: {
|
||||||
|
heredoc: [{
|
||||||
|
onMatch: function(value, currentState, stack) {
|
||||||
|
if (value === stack[1]) {
|
||||||
|
stack.shift();
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack[0] || "start";
|
||||||
|
return "support.class";
|
||||||
|
}
|
||||||
|
this.next = "";
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: ".*$",
|
||||||
|
next: "start"
|
||||||
|
}],
|
||||||
|
indentedHeredoc: [{
|
||||||
|
token: "string",
|
||||||
|
regex: "^ +"
|
||||||
|
}, {
|
||||||
|
onMatch: function(value, currentState, stack) {
|
||||||
|
if (value === stack[1]) {
|
||||||
|
stack.shift();
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack[0] || "start";
|
||||||
|
return "support.class";
|
||||||
|
}
|
||||||
|
this.next = "";
|
||||||
|
return "string";
|
||||||
|
},
|
||||||
|
regex: ".*$",
|
||||||
|
next: "start"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
regex : "$",
|
||||||
|
token : "empty",
|
||||||
|
next : function(currentState, stack) {
|
||||||
|
if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
|
||||||
|
return stack[0];
|
||||||
|
return currentState;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : "^=end(?:$|\\s.*$)",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(RubyHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.RubyHighlightRules = RubyHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2423
src/main/webapp/assets/ace/mode-handlebars.js
Normal file
2423
src/main/webapp/assets/ace/mode-handlebars.js
Normal file
File diff suppressed because it is too large
Load Diff
361
src/main/webapp/assets/ace/mode-haskell.js
Normal file
361
src/main/webapp/assets/ace/mode-haskell.js
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/haskell', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/haskell_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HaskellHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/haskell";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/haskell_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var HaskellHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.entity.haskell',
|
||||||
|
'keyword.operator.function.infix.haskell',
|
||||||
|
'punctuation.definition.entity.haskell' ],
|
||||||
|
regex: '(`)([a-zA-Z_\']*?)(`)',
|
||||||
|
comment: 'In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).' },
|
||||||
|
{ token: 'constant.language.unit.haskell', regex: '\\(\\)' },
|
||||||
|
{ token: 'constant.language.empty-list.haskell',
|
||||||
|
regex: '\\[\\]' },
|
||||||
|
{ token: 'keyword.other.haskell',
|
||||||
|
regex: 'module',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.other.haskell', regex: 'where', next: 'pop' },
|
||||||
|
{ include: '#module_name' },
|
||||||
|
{ include: '#module_exports' },
|
||||||
|
{ token: 'invalid', regex: '[a-z]+' },
|
||||||
|
{ defaultToken: 'meta.declaration.module.haskell' } ] },
|
||||||
|
{ token: 'keyword.other.haskell',
|
||||||
|
regex: '\\bclass\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.other.haskell',
|
||||||
|
regex: '\\bwhere\\b',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'support.class.prelude.haskell',
|
||||||
|
regex: '\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\b' },
|
||||||
|
{ token: 'entity.other.inherited-class.haskell',
|
||||||
|
regex: '[A-Z][A-Za-z_\']*' },
|
||||||
|
{ token: 'variable.other.generic-type.haskell',
|
||||||
|
regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
|
||||||
|
{ defaultToken: 'meta.declaration.class.haskell' } ] },
|
||||||
|
{ token: 'keyword.other.haskell',
|
||||||
|
regex: '\\binstance\\b',
|
||||||
|
push:
|
||||||
|
[ { token: 'keyword.other.haskell',
|
||||||
|
regex: '\\bwhere\\b|$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#type_signature' },
|
||||||
|
{ defaultToken: 'meta.declaration.instance.haskell' } ] },
|
||||||
|
{ token: 'keyword.other.haskell',
|
||||||
|
regex: 'import',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.import.haskell', regex: '$|;', next: 'pop' },
|
||||||
|
{ token: 'keyword.other.haskell', regex: 'qualified|as|hiding' },
|
||||||
|
{ include: '#module_name' },
|
||||||
|
{ include: '#module_exports' },
|
||||||
|
{ defaultToken: 'meta.import.haskell' } ] },
|
||||||
|
{ token: [ 'keyword.other.haskell', 'meta.deriving.haskell' ],
|
||||||
|
regex: '(deriving)(\\s*\\()',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.deriving.haskell', regex: '\\)', next: 'pop' },
|
||||||
|
{ token: 'entity.other.inherited-class.haskell',
|
||||||
|
regex: '\\b[A-Z][a-zA-Z_\']*' },
|
||||||
|
{ defaultToken: 'meta.deriving.haskell' } ] },
|
||||||
|
{ token: 'keyword.other.haskell',
|
||||||
|
regex: '\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\b' },
|
||||||
|
{ token: 'keyword.operator.haskell', regex: '\\binfix[lr]?\\b' },
|
||||||
|
{ token: 'keyword.control.haskell',
|
||||||
|
regex: '\\b(?:do|if|then|else)\\b' },
|
||||||
|
{ token: 'constant.numeric.float.haskell',
|
||||||
|
regex: '\\b(?:[0-9]+\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b',
|
||||||
|
comment: 'Floats are always decimal' },
|
||||||
|
{ token: 'constant.numeric.haskell',
|
||||||
|
regex: '\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\b' },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.preprocessor.c',
|
||||||
|
'punctuation.definition.preprocessor.c',
|
||||||
|
'meta.preprocessor.c' ],
|
||||||
|
regex: '^(\\s*)(#)(\\s*\\w+)',
|
||||||
|
comment: 'In addition to Haskell\'s "native" syntax, GHC permits the C preprocessor to be run on a source file.' },
|
||||||
|
{ include: '#pragma' },
|
||||||
|
{ token: 'punctuation.definition.string.begin.haskell',
|
||||||
|
regex: '"',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.haskell',
|
||||||
|
regex: '"',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'constant.character.escape.haskell',
|
||||||
|
regex: '\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&])' },
|
||||||
|
{ token: 'constant.character.escape.octal.haskell',
|
||||||
|
regex: '\\\\o[0-7]+|\\\\x[0-9A-Fa-f]+|\\\\[0-9]+' },
|
||||||
|
{ token: 'constant.character.escape.control.haskell',
|
||||||
|
regex: '\\^[A-Z@\\[\\]\\\\\\^_]' },
|
||||||
|
{ defaultToken: 'string.quoted.double.haskell' } ] },
|
||||||
|
{ token:
|
||||||
|
[ 'punctuation.definition.string.begin.haskell',
|
||||||
|
'string.quoted.single.haskell',
|
||||||
|
'constant.character.escape.haskell',
|
||||||
|
'constant.character.escape.octal.haskell',
|
||||||
|
'constant.character.escape.hexadecimal.haskell',
|
||||||
|
'constant.character.escape.control.haskell',
|
||||||
|
'punctuation.definition.string.end.haskell' ],
|
||||||
|
regex: '(\')(?:([\\ -\\[\\]-~])|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))(\')' },
|
||||||
|
{ token:
|
||||||
|
[ 'meta.function.type-declaration.haskell',
|
||||||
|
'entity.name.function.haskell',
|
||||||
|
'meta.function.type-declaration.haskell',
|
||||||
|
'keyword.other.double-colon.haskell' ],
|
||||||
|
regex: '^(\\s*)([a-z_][a-zA-Z0-9_\']*|\\([|!%$+\\-.,=</>]+\\))(\\s*)(::)',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.function.type-declaration.haskell',
|
||||||
|
regex: '$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#type_signature' },
|
||||||
|
{ defaultToken: 'meta.function.type-declaration.haskell' } ] },
|
||||||
|
{ token: 'support.constant.haskell',
|
||||||
|
regex: '\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\(\\)|\\[\\])\\b' },
|
||||||
|
{ token: 'constant.other.haskell', regex: '\\b[A-Z]\\w*\\b' },
|
||||||
|
{ include: '#comments' },
|
||||||
|
{ token: 'support.function.prelude.haskell',
|
||||||
|
regex: '\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\b' },
|
||||||
|
{ include: '#infix_op' },
|
||||||
|
{ token: 'keyword.operator.haskell',
|
||||||
|
regex: '[|!%$?~+:\\-.=</>\\\\]+',
|
||||||
|
comment: 'In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.' },
|
||||||
|
{ token: 'punctuation.separator.comma.haskell', regex: ',' } ],
|
||||||
|
'#block_comment':
|
||||||
|
[ { token: 'punctuation.definition.comment.haskell',
|
||||||
|
regex: '\\{-(?!#)',
|
||||||
|
push:
|
||||||
|
[ { include: '#block_comment' },
|
||||||
|
{ token: 'punctuation.definition.comment.haskell',
|
||||||
|
regex: '-\\}',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block.haskell' } ] } ],
|
||||||
|
'#comments':
|
||||||
|
[ { token: 'punctuation.definition.comment.haskell',
|
||||||
|
regex: '--.*',
|
||||||
|
push_:
|
||||||
|
[ { token: 'comment.line.double-dash.haskell',
|
||||||
|
regex: '$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.line.double-dash.haskell' } ] },
|
||||||
|
{ include: '#block_comment' } ],
|
||||||
|
'#infix_op':
|
||||||
|
[ { token: 'entity.name.function.infix.haskell',
|
||||||
|
regex: '\\([|!%$+:\\-.=</>]+\\)|\\(,+\\)' } ],
|
||||||
|
'#module_exports':
|
||||||
|
[ { token: 'meta.declaration.exports.haskell',
|
||||||
|
regex: '\\(',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.declaration.exports.haskell',
|
||||||
|
regex: '\\)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'entity.name.function.haskell',
|
||||||
|
regex: '\\b[a-z][a-zA-Z_\']*' },
|
||||||
|
{ token: 'storage.type.haskell', regex: '\\b[A-Z][A-Za-z_\']*' },
|
||||||
|
{ token: 'punctuation.separator.comma.haskell', regex: ',' },
|
||||||
|
{ include: '#infix_op' },
|
||||||
|
{ token: 'meta.other.unknown.haskell',
|
||||||
|
regex: '\\(.*?\\)',
|
||||||
|
comment: 'So named because I don\'t know what to call this.' },
|
||||||
|
{ defaultToken: 'meta.declaration.exports.haskell' } ] } ],
|
||||||
|
'#module_name':
|
||||||
|
[ { token: 'support.other.module.haskell',
|
||||||
|
regex: '[A-Z][A-Za-z._\']*' } ],
|
||||||
|
'#pragma':
|
||||||
|
[ { token: 'meta.preprocessor.haskell',
|
||||||
|
regex: '\\{-#',
|
||||||
|
push:
|
||||||
|
[ { token: 'meta.preprocessor.haskell',
|
||||||
|
regex: '#-\\}',
|
||||||
|
next: 'pop' },
|
||||||
|
{ token: 'keyword.other.preprocessor.haskell',
|
||||||
|
regex: '\\b(?:LANGUAGE|UNPACK|INLINE)\\b' },
|
||||||
|
{ defaultToken: 'meta.preprocessor.haskell' } ] } ],
|
||||||
|
'#type_signature':
|
||||||
|
[ { token:
|
||||||
|
[ 'meta.class-constraint.haskell',
|
||||||
|
'entity.other.inherited-class.haskell',
|
||||||
|
'meta.class-constraint.haskell',
|
||||||
|
'variable.other.generic-type.haskell',
|
||||||
|
'meta.class-constraint.haskell',
|
||||||
|
'keyword.other.big-arrow.haskell' ],
|
||||||
|
regex: '(\\(\\s*)([A-Z][A-Za-z]*)(\\s+)([a-z][A-Za-z_\']*)(\\)\\s*)(=>)' },
|
||||||
|
{ include: '#pragma' },
|
||||||
|
{ token: 'keyword.other.arrow.haskell', regex: '->' },
|
||||||
|
{ token: 'keyword.other.big-arrow.haskell', regex: '=>' },
|
||||||
|
{ token: 'support.type.prelude.haskell',
|
||||||
|
regex: '\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\b' },
|
||||||
|
{ token: 'variable.other.generic-type.haskell',
|
||||||
|
regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
|
||||||
|
{ token: 'storage.type.haskell',
|
||||||
|
regex: '\\b[A-Z][a-zA-Z0-9_\']*\\b' },
|
||||||
|
{ token: 'support.constant.unit.haskell', regex: '\\(\\)' },
|
||||||
|
{ include: '#comments' } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
HaskellHighlightRules.metaData = { fileTypes: [ 'hs' ],
|
||||||
|
keyEquivalent: '^~H',
|
||||||
|
name: 'Haskell',
|
||||||
|
scopeName: 'source.haskell' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(HaskellHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.HaskellHighlightRules = HaskellHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
686
src/main/webapp/assets/ace/mode-haxe.js
Normal file
686
src/main/webapp/assets/ace/mode-haxe.js
Normal file
@@ -0,0 +1,686 @@
|
|||||||
|
ace.define('ace/mode/haxe', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/haxe_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HaxeHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/haxe";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/haxe_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var HaxeHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = (
|
||||||
|
"null|true|false"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language": "this",
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string.regexp",
|
||||||
|
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({<]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}>]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(HaxeHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.HaxeHighlightRules = HaxeHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2335
src/main/webapp/assets/ace/mode-html.js
Normal file
2335
src/main/webapp/assets/ace/mode-html.js
Normal file
File diff suppressed because it is too large
Load Diff
309
src/main/webapp/assets/ace/mode-html_completions.js
Normal file
309
src/main/webapp/assets/ace/mode-html_completions.js
Normal file
@@ -0,0 +1,309 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
var commonAttributes = [
|
||||||
|
"accesskey",
|
||||||
|
"class",
|
||||||
|
"contenteditable",
|
||||||
|
"contextmenu",
|
||||||
|
"dir",
|
||||||
|
"draggable",
|
||||||
|
"dropzone",
|
||||||
|
"hidden",
|
||||||
|
"id",
|
||||||
|
"lang",
|
||||||
|
"spellcheck",
|
||||||
|
"style",
|
||||||
|
"tabindex",
|
||||||
|
"title",
|
||||||
|
"translate"
|
||||||
|
];
|
||||||
|
|
||||||
|
var eventAttributes = [
|
||||||
|
"onabort",
|
||||||
|
"onblur",
|
||||||
|
"oncancel",
|
||||||
|
"oncanplay",
|
||||||
|
"oncanplaythrough",
|
||||||
|
"onchange",
|
||||||
|
"onclick",
|
||||||
|
"onclose",
|
||||||
|
"oncontextmenu",
|
||||||
|
"oncuechange",
|
||||||
|
"ondblclick",
|
||||||
|
"ondrag",
|
||||||
|
"ondragend",
|
||||||
|
"ondragenter",
|
||||||
|
"ondragleave",
|
||||||
|
"ondragover",
|
||||||
|
"ondragstart",
|
||||||
|
"ondrop",
|
||||||
|
"ondurationchange",
|
||||||
|
"onemptied",
|
||||||
|
"onended",
|
||||||
|
"onerror",
|
||||||
|
"onfocus",
|
||||||
|
"oninput",
|
||||||
|
"oninvalid",
|
||||||
|
"onkeydown",
|
||||||
|
"onkeypress",
|
||||||
|
"onkeyup",
|
||||||
|
"onload",
|
||||||
|
"onloadeddata",
|
||||||
|
"onloadedmetadata",
|
||||||
|
"onloadstart",
|
||||||
|
"onmousedown",
|
||||||
|
"onmousemove",
|
||||||
|
"onmouseout",
|
||||||
|
"onmouseover",
|
||||||
|
"onmouseup",
|
||||||
|
"onmousewheel",
|
||||||
|
"onpause",
|
||||||
|
"onplay",
|
||||||
|
"onplaying",
|
||||||
|
"onprogress",
|
||||||
|
"onratechange",
|
||||||
|
"onreset",
|
||||||
|
"onscroll",
|
||||||
|
"onseeked",
|
||||||
|
"onseeking",
|
||||||
|
"onselect",
|
||||||
|
"onshow",
|
||||||
|
"onstalled",
|
||||||
|
"onsubmit",
|
||||||
|
"onsuspend",
|
||||||
|
"ontimeupdate",
|
||||||
|
"onvolumechange",
|
||||||
|
"onwaiting"
|
||||||
|
];
|
||||||
|
|
||||||
|
var globalAttributes = commonAttributes.concat(eventAttributes);
|
||||||
|
|
||||||
|
var attributeMap = {
|
||||||
|
"html": ["manifest"],
|
||||||
|
"head": [],
|
||||||
|
"title": [],
|
||||||
|
"base": ["href", "target"],
|
||||||
|
"link": ["href", "hreflang", "rel", "media", "type", "sizes"],
|
||||||
|
"meta": ["http-equiv", "name", "content", "charset"],
|
||||||
|
"style": ["type", "media", "scoped"],
|
||||||
|
"script": ["charset", "type", "src", "defer", "async"],
|
||||||
|
"noscript": ["href"],
|
||||||
|
"body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
|
||||||
|
"section": [],
|
||||||
|
"nav": [],
|
||||||
|
"article": ["pubdate"],
|
||||||
|
"aside": [],
|
||||||
|
"h1": [],
|
||||||
|
"h2": [],
|
||||||
|
"h3": [],
|
||||||
|
"h4": [],
|
||||||
|
"h5": [],
|
||||||
|
"h6": [],
|
||||||
|
"header": [],
|
||||||
|
"footer": [],
|
||||||
|
"address": [],
|
||||||
|
"main": [],
|
||||||
|
"p": [],
|
||||||
|
"hr": [],
|
||||||
|
"pre": [],
|
||||||
|
"blockquote": ["cite"],
|
||||||
|
"ol": ["start", "reversed"],
|
||||||
|
"ul": [],
|
||||||
|
"li": ["value"],
|
||||||
|
"dl": [],
|
||||||
|
"dt": [],
|
||||||
|
"dd": [],
|
||||||
|
"figure": [],
|
||||||
|
"figcaption": [],
|
||||||
|
"div": [],
|
||||||
|
"a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
|
||||||
|
"em": [],
|
||||||
|
"strong": [],
|
||||||
|
"small": [],
|
||||||
|
"s": [],
|
||||||
|
"cite": [],
|
||||||
|
"q": ["cite"],
|
||||||
|
"dfn": [],
|
||||||
|
"abbr": [],
|
||||||
|
"data": [],
|
||||||
|
"time": ["datetime"],
|
||||||
|
"code": [],
|
||||||
|
"var": [],
|
||||||
|
"samp": [],
|
||||||
|
"kbd": [],
|
||||||
|
"sub": [],
|
||||||
|
"sup": [],
|
||||||
|
"i": [],
|
||||||
|
"b": [],
|
||||||
|
"u": [],
|
||||||
|
"mark": [],
|
||||||
|
"ruby": [],
|
||||||
|
"rt": [],
|
||||||
|
"rp": [],
|
||||||
|
"bdi": [],
|
||||||
|
"bdo": [],
|
||||||
|
"span": [],
|
||||||
|
"br": [],
|
||||||
|
"wbr": [],
|
||||||
|
"ins": ["cite", "datetime"],
|
||||||
|
"del": ["cite", "datetime"],
|
||||||
|
"img": ["alt", "src", "height", "width", "usemap", "ismap"],
|
||||||
|
"iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
|
||||||
|
"embed": ["src", "height", "width", "type"],
|
||||||
|
"object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
|
||||||
|
"param": ["name", "value"],
|
||||||
|
"video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
|
||||||
|
"audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
|
||||||
|
"source": ["src", "type", "media"],
|
||||||
|
"track": ["kind", "src", "srclang", "label", "default"],
|
||||||
|
"canvas": ["width", "height"],
|
||||||
|
"map": ["name"],
|
||||||
|
"area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
|
||||||
|
"svg": [],
|
||||||
|
"math": [],
|
||||||
|
"table": ["summary"],
|
||||||
|
"caption": [],
|
||||||
|
"colgroup": ["span"],
|
||||||
|
"col": ["span"],
|
||||||
|
"tbody": [],
|
||||||
|
"thead": [],
|
||||||
|
"tfoot": [],
|
||||||
|
"tr": [],
|
||||||
|
"td": ["headers", "rowspan", "colspan"],
|
||||||
|
"th": ["headers", "rowspan", "colspan", "scope"],
|
||||||
|
"form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
|
||||||
|
"fieldset": ["disabled", "form", "name"],
|
||||||
|
"legend": [],
|
||||||
|
"label": ["form", "for"],
|
||||||
|
"input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
|
||||||
|
"button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
|
||||||
|
"select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
|
||||||
|
"datalist": [],
|
||||||
|
"optgroup": ["disabled", "label"],
|
||||||
|
"option": ["disabled", "selected", "label", "value"],
|
||||||
|
"textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
|
||||||
|
"keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
|
||||||
|
"output": ["for", "form", "name"],
|
||||||
|
"progress": ["value", "max"],
|
||||||
|
"meter": ["value", "min", "max", "low", "high", "optimum"],
|
||||||
|
"details": ["open"],
|
||||||
|
"summary": [],
|
||||||
|
"command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
|
||||||
|
"menu": ["type", "label"],
|
||||||
|
"dialog": ["open"]
|
||||||
|
};
|
||||||
|
|
||||||
|
var allElements = Object.keys(attributeMap);
|
||||||
|
|
||||||
|
function hasType(token, type) {
|
||||||
|
var tokenTypes = token.type.split('.');
|
||||||
|
return type.split('.').every(function(type){
|
||||||
|
return (tokenTypes.indexOf(type) !== -1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function findTagName(session, pos) {
|
||||||
|
var iterator = new TokenIterator(session, pos.row, pos.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
||||||
|
do {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
} while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text')));
|
||||||
|
}
|
||||||
|
if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/'))
|
||||||
|
return token.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
var HtmlCompletions = function() {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getCompletions = function(state, session, pos, prefix) {
|
||||||
|
var token = session.getTokenAt(pos.row, pos.column);
|
||||||
|
|
||||||
|
if (!token)
|
||||||
|
return [];
|
||||||
|
if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text")))
|
||||||
|
return this.getTagCompletions(state, session, pos, prefix);
|
||||||
|
if (hasType(token, 'text') || hasType(token, 'attribute-name'))
|
||||||
|
return this.getAttributeCompetions(state, session, pos, prefix);
|
||||||
|
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getTagCompletions = function(state, session, pos, prefix) {
|
||||||
|
var elements = allElements;
|
||||||
|
if (prefix) {
|
||||||
|
elements = elements.filter(function(element){
|
||||||
|
return element.indexOf(prefix) === 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return elements.map(function(element){
|
||||||
|
return {
|
||||||
|
value: element,
|
||||||
|
meta: "tag"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getAttributeCompetions = function(state, session, pos, prefix) {
|
||||||
|
var tagName = findTagName(session, pos);
|
||||||
|
if (!tagName)
|
||||||
|
return [];
|
||||||
|
var attributes = globalAttributes;
|
||||||
|
if (tagName in attributeMap) {
|
||||||
|
attributes = attributes.concat(attributeMap[tagName]);
|
||||||
|
}
|
||||||
|
if (prefix) {
|
||||||
|
attributes = attributes.filter(function(attribute){
|
||||||
|
return attribute.indexOf(prefix) === 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return attributes.map(function(attribute){
|
||||||
|
return {
|
||||||
|
caption: attribute,
|
||||||
|
snippet: attribute + '="$0"',
|
||||||
|
meta: "attribute"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(HtmlCompletions.prototype);
|
||||||
|
|
||||||
|
exports.HtmlCompletions = HtmlCompletions;
|
||||||
|
});
|
||||||
2794
src/main/webapp/assets/ace/mode-html_ruby.js
Normal file
2794
src/main/webapp/assets/ace/mode-html_ruby.js
Normal file
File diff suppressed because it is too large
Load Diff
184
src/main/webapp/assets/ace/mode-ini.js
Normal file
184
src/main/webapp/assets/ace/mode-ini.js
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/ini', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/ini_highlight_rules', 'ace/mode/folding/ini'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
|
||||||
|
var FoldMode = require("./folding/ini").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = IniHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = ";";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/ini";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/ini_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
|
||||||
|
|
||||||
|
var IniHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
start: [{
|
||||||
|
token: 'punctuation.definition.comment.ini',
|
||||||
|
regex: '#.*',
|
||||||
|
push_: [{
|
||||||
|
token: 'comment.line.number-sign.ini',
|
||||||
|
regex: '$|^',
|
||||||
|
next: 'pop'
|
||||||
|
}, {
|
||||||
|
defaultToken: 'comment.line.number-sign.ini'
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.definition.comment.ini',
|
||||||
|
regex: ';.*',
|
||||||
|
push_: [{
|
||||||
|
token: 'comment.line.semicolon.ini',
|
||||||
|
regex: '$|^',
|
||||||
|
next: 'pop'
|
||||||
|
}, {
|
||||||
|
defaultToken: 'comment.line.semicolon.ini'
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
|
||||||
|
regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
|
||||||
|
}, {
|
||||||
|
token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
|
||||||
|
regex: '^(\\[)(.*?)(\\])'
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.definition.string.begin.ini',
|
||||||
|
regex: "'",
|
||||||
|
push: [{
|
||||||
|
token: 'punctuation.definition.string.end.ini',
|
||||||
|
regex: "'",
|
||||||
|
next: 'pop'
|
||||||
|
}, {
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: escapeRe
|
||||||
|
}, {
|
||||||
|
defaultToken: 'string.quoted.single.ini'
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.definition.string.begin.ini',
|
||||||
|
regex: '"',
|
||||||
|
push: [{
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: escapeRe
|
||||||
|
}, {
|
||||||
|
token: 'punctuation.definition.string.end.ini',
|
||||||
|
regex: '"',
|
||||||
|
next: 'pop'
|
||||||
|
}, {
|
||||||
|
defaultToken: 'string.quoted.double.ini'
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
IniHighlightRules.metaData = {
|
||||||
|
fileTypes: ['ini', 'conf'],
|
||||||
|
keyEquivalent: '^~I',
|
||||||
|
name: 'Ini',
|
||||||
|
scopeName: 'source.ini'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(IniHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.IniHighlightRules = IniHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/ini', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var re = this.foldingStartMarker;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
|
||||||
|
var m = line.match(re);
|
||||||
|
|
||||||
|
if (!m) return;
|
||||||
|
|
||||||
|
var startName = m[1] + ".";
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
if (/^\s*$/.test(line))
|
||||||
|
continue;
|
||||||
|
m = line.match(re);
|
||||||
|
if (m && m[1].lastIndexOf(startName, 0) !== 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
682
src/main/webapp/assets/ace/mode-jack.js
Normal file
682
src/main/webapp/assets/ace/mode-jack.js
Normal file
@@ -0,0 +1,682 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/jack', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/jack_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HighlightRules = require("./jack_highlight_rules").JackHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.$id = "ace/mode/jack";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/jack_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var JackHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next : "string2"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'",
|
||||||
|
next : "string1"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex: "-?0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "(?:0|[-+]?[1-9][0-9]*)\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.binary",
|
||||||
|
regex : "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.null",
|
||||||
|
regex : "null\\b"
|
||||||
|
}, {
|
||||||
|
token : "storage.type",
|
||||||
|
regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b"
|
||||||
|
}, {
|
||||||
|
token : "language.builtin",
|
||||||
|
regex : "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "--.*$"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "storage.form",
|
||||||
|
regex : "@[a-z]+"
|
||||||
|
}, {
|
||||||
|
token : "constant.other.symbol",
|
||||||
|
regex : ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
|
||||||
|
}, {
|
||||||
|
token : "variable",
|
||||||
|
regex : '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"string1" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "[^'\\\\]+"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"string2" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '[^"\\\\]+'
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(JackHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.JackHighlightRules = JackHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2025
src/main/webapp/assets/ace/mode-jade.js
Normal file
2025
src/main/webapp/assets/ace/mode-jade.js
Normal file
File diff suppressed because it is too large
Load Diff
1078
src/main/webapp/assets/ace/mode-java.js
Normal file
1078
src/main/webapp/assets/ace/mode-java.js
Normal file
File diff suppressed because it is too large
Load Diff
962
src/main/webapp/assets/ace/mode-javascript.js
Normal file
962
src/main/webapp/assets/ace/mode-javascript.js
Normal file
@@ -0,0 +1,962 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = JavaScriptHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start" || state == "no_regex") {
|
||||||
|
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
} else if (state == "doc-start") {
|
||||||
|
if (endState == "start" || endState == "no_regex") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var match = line.match(/^\s*(\/?)\*/);
|
||||||
|
if (match) {
|
||||||
|
if (match[1]) {
|
||||||
|
indent += " ";
|
||||||
|
}
|
||||||
|
indent += "* ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("jslint", function(results) {
|
||||||
|
session.setAnnotations(results.data);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("terminate", function() {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/javascript";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var JavaScriptHighlightRules = function() {
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language":
|
||||||
|
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
||||||
|
"Namespace|QName|XML|XMLList|" + // E4X
|
||||||
|
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
||||||
|
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
||||||
|
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
||||||
|
"SyntaxError|TypeError|URIError|" +
|
||||||
|
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
||||||
|
"isNaN|parseFloat|parseInt|" +
|
||||||
|
"JSON|Math|" + // Other
|
||||||
|
"this|arguments|prototype|window|document" , // Pseudo
|
||||||
|
"keyword":
|
||||||
|
"const|yield|import|get|set|" +
|
||||||
|
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
||||||
|
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
|
||||||
|
"__parent__|__count__|escape|unescape|with|__proto__|" +
|
||||||
|
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
|
||||||
|
"storage.type":
|
||||||
|
"const|let|var|function",
|
||||||
|
"constant.language":
|
||||||
|
"null|Infinity|NaN|undefined",
|
||||||
|
"support.function":
|
||||||
|
"alert",
|
||||||
|
"constant.language.boolean": "true|false"
|
||||||
|
}, "identifier");
|
||||||
|
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
|
||||||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
|
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||||
|
"u[0-9a-fA-F]{4}|" + // unicode
|
||||||
|
"[0-2][0-7]{0,2}|" + // oct
|
||||||
|
"3[0-6][0-7]?|" + // oct
|
||||||
|
"37[0-7]?|" + // oct
|
||||||
|
"[4-7][0-7]?|" + //oct
|
||||||
|
".)";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"no_regex" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/",
|
||||||
|
next : "line_comment"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : /\/\*/,
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'(?=.)",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"(?=.)',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"storage.type", "punctuation.operator", "support.function",
|
||||||
|
"punctuation.operator", "entity.name.function", "text","keyword.operator"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||||
|
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
|
||||||
|
"text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||||
|
"keyword.operator", "text",
|
||||||
|
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"entity.name.function", "text", "punctuation.operator",
|
||||||
|
"text", "storage.type", "text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"text", "text", "storage.type", "text", "paren.lparen"
|
||||||
|
],
|
||||||
|
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||||
|
next: "function_arguments"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation.operator", "support.function"],
|
||||||
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
|
}, {
|
||||||
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
|
}, {
|
||||||
|
token : ["punctuation.operator", "support.constant"],
|
||||||
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
|
}, {
|
||||||
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : identifierRe
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : /\?|\:|\,|\;|\./,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : /[\[({]/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : /[\])}]/
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : /\/=?/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token: "comment",
|
||||||
|
regex: /^#!.*$/
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": [
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment_regex_allowed"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/",
|
||||||
|
next : "line_comment_regex_allowed"
|
||||||
|
}, {
|
||||||
|
token: "string.regexp",
|
||||||
|
regex: "\\/",
|
||||||
|
next: "regex"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+|^$",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token: "empty",
|
||||||
|
regex: "",
|
||||||
|
next: "no_regex"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"regex": [
|
||||||
|
{
|
||||||
|
token: "regexp.keyword.operator",
|
||||||
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||||
|
}, {
|
||||||
|
token: "string.regexp",
|
||||||
|
regex: "/[sxngimy]*",
|
||||||
|
next: "no_regex"
|
||||||
|
}, {
|
||||||
|
token : "invalid",
|
||||||
|
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
|
||||||
|
}, {
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
||||||
|
}, {
|
||||||
|
token : "constant.language.delimiter",
|
||||||
|
regex: /\|/
|
||||||
|
}, {
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: /\[\^?/,
|
||||||
|
next: "regex_character_class"
|
||||||
|
}, {
|
||||||
|
token: "empty",
|
||||||
|
regex: "$",
|
||||||
|
next: "no_regex"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.regexp"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"regex_character_class": [
|
||||||
|
{
|
||||||
|
token: "regexp.keyword.operator",
|
||||||
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||||
|
}, {
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: "]",
|
||||||
|
next: "regex"
|
||||||
|
}, {
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: "-"
|
||||||
|
}, {
|
||||||
|
token: "empty",
|
||||||
|
regex: "$",
|
||||||
|
next: "no_regex"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.regexp.charachterclass"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"function_arguments": [
|
||||||
|
{
|
||||||
|
token: "variable.parameter",
|
||||||
|
regex: identifierRe
|
||||||
|
}, {
|
||||||
|
token: "punctuation.operator",
|
||||||
|
regex: "[, ]+"
|
||||||
|
}, {
|
||||||
|
token: "punctuation.operator",
|
||||||
|
regex: "$"
|
||||||
|
}, {
|
||||||
|
token: "empty",
|
||||||
|
regex: "",
|
||||||
|
next: "no_regex"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment_regex_allowed" : [
|
||||||
|
{token : "comment", regex : "\\*\\/", next : "start"},
|
||||||
|
{defaultToken : "comment"}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
||||||
|
{defaultToken : "comment"}
|
||||||
|
],
|
||||||
|
"line_comment_regex_allowed" : [
|
||||||
|
{token : "comment", regex : "$|^", next : "start"},
|
||||||
|
{defaultToken : "comment"}
|
||||||
|
],
|
||||||
|
"line_comment" : [
|
||||||
|
{token : "comment", regex : "$|^", next : "no_regex"},
|
||||||
|
{defaultToken : "comment"}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : escapedRe
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"|$',
|
||||||
|
next : "no_regex"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : escapedRe
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'|$",
|
||||||
|
next : "no_regex"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
654
src/main/webapp/assets/ace/mode-json.js
Normal file
654
src/main/webapp/assets/ace/mode-json.js
Normal file
@@ -0,0 +1,654 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/json', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/json_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/worker/worker_client'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function() {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.$id = "ace/mode/json";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/json_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var JsonHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "variable", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '"',
|
||||||
|
next : "string"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : "invalid.illegal", // single quoted strings are not allowed
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "invalid.illegal", // comments are not allowed
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"string" : [
|
||||||
|
{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '[^"\\\\]+'
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(JsonHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.JsonHighlightRules = JsonHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
4628
src/main/webapp/assets/ace/mode-jsoniq.js
Normal file
4628
src/main/webapp/assets/ace/mode-jsoniq.js
Normal file
File diff suppressed because one or more lines are too long
1520
src/main/webapp/assets/ace/mode-jsp.js
Normal file
1520
src/main/webapp/assets/ace/mode-jsp.js
Normal file
File diff suppressed because it is too large
Load Diff
711
src/main/webapp/assets/ace/mode-jsx.js
Normal file
711
src/main/webapp/assets/ace/mode-jsx.js
Normal file
@@ -0,0 +1,711 @@
|
|||||||
|
ace.define('ace/mode/jsx', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/jsx_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
function Mode() {
|
||||||
|
this.HighlightRules = JsxHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
}
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/jsx";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/jsx_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var JsxHighlightRules = function() {
|
||||||
|
var keywords = lang.arrayToMap(
|
||||||
|
("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
|
||||||
|
"if|throw|" +
|
||||||
|
"delete|in|try|" +
|
||||||
|
"class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
|
||||||
|
"number|int|string|boolean|variant|" +
|
||||||
|
"log|assert").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = lang.arrayToMap(
|
||||||
|
("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var reserved = lang.arrayToMap(
|
||||||
|
("debugger|with|" +
|
||||||
|
"const|export|" +
|
||||||
|
"let|private|public|yield|protected|" +
|
||||||
|
"extern|native|as|operator|__fake__|__readonly__").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string.regexp",
|
||||||
|
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function"
|
||||||
|
],
|
||||||
|
regex : "(function)(\\s+)(" + identifierRe + ")"
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (value == "this")
|
||||||
|
return "variable.language";
|
||||||
|
else if (value == "function")
|
||||||
|
return "storage.type";
|
||||||
|
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else if (buildinConstants.hasOwnProperty(value))
|
||||||
|
return "constant.language";
|
||||||
|
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
|
||||||
|
return "language.support.class";
|
||||||
|
else
|
||||||
|
return "identifier";
|
||||||
|
},
|
||||||
|
regex : identifierRe
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({<]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}>]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(JsxHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.JsxHighlightRules = JsxHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
285
src/main/webapp/assets/ace/mode-julia.js
Normal file
285
src/main/webapp/assets/ace/mode-julia.js
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/julia', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/julia_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules;
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = JuliaHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.blockComment = "";
|
||||||
|
this.$id = "ace/mode/julia";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/julia_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var JuliaHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { include: '#function_decl' },
|
||||||
|
{ include: '#function_call' },
|
||||||
|
{ include: '#type_decl' },
|
||||||
|
{ include: '#keyword' },
|
||||||
|
{ include: '#operator' },
|
||||||
|
{ include: '#number' },
|
||||||
|
{ include: '#string' },
|
||||||
|
{ include: '#comment' } ],
|
||||||
|
'#bracket':
|
||||||
|
[ { token: 'keyword.bracket.julia',
|
||||||
|
regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ],
|
||||||
|
'#comment':
|
||||||
|
[ { token:
|
||||||
|
[ 'punctuation.definition.comment.julia',
|
||||||
|
'comment.line.number-sign.julia' ],
|
||||||
|
regex: '(#)(?!\\{)(.*$)'} ],
|
||||||
|
'#function_call':
|
||||||
|
[ { token: [ 'support.function.julia', 'text' ],
|
||||||
|
regex: '([a-zA-Z0-9_]+!?)(\\w*\\()'} ],
|
||||||
|
'#function_decl':
|
||||||
|
[ { token: [ 'keyword.other.julia', 'meta.function.julia',
|
||||||
|
'entity.name.function.julia', 'meta.function.julia','text' ],
|
||||||
|
regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])'} ],
|
||||||
|
'#keyword':
|
||||||
|
[ { token: 'keyword.other.julia',
|
||||||
|
regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
|
||||||
|
{ token: 'keyword.control.julia',
|
||||||
|
regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' },
|
||||||
|
{ token: 'storage.modifier.variable.julia',
|
||||||
|
regex: '\\b(?:global|local|const|export|import|importall|using)\\b' },
|
||||||
|
{ token: 'variable.macro.julia', regex: '@\\w+\\b' } ],
|
||||||
|
'#number':
|
||||||
|
[ { token: 'constant.numeric.julia',
|
||||||
|
regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ],
|
||||||
|
'#operator':
|
||||||
|
[ { token: 'keyword.operator.update.julia',
|
||||||
|
regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' },
|
||||||
|
{ token: 'keyword.operator.ternary.julia', regex: '\\?|:' },
|
||||||
|
{ token: 'keyword.operator.boolean.julia',
|
||||||
|
regex: '\\|\\||&&|!' },
|
||||||
|
{ token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' },
|
||||||
|
{ token: 'keyword.operator.relation.julia',
|
||||||
|
regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' },
|
||||||
|
{ token: 'keyword.operator.range.julia', regex: ':' },
|
||||||
|
{ token: 'keyword.operator.shift.julia', regex: '<<|>>' },
|
||||||
|
{ token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' },
|
||||||
|
{ token: 'keyword.operator.arithmetic.julia',
|
||||||
|
regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' },
|
||||||
|
{ token: 'keyword.operator.isa.julia', regex: '::' },
|
||||||
|
{ token: 'keyword.operator.dots.julia',
|
||||||
|
regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
|
||||||
|
{ token: 'keyword.operator.interpolation.julia',
|
||||||
|
regex: '\\$#?(?=.)' },
|
||||||
|
{ token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
|
||||||
|
regex: '(\\w+)((?:\'|\\.\')*\\.?\')' },
|
||||||
|
{ token: 'text',
|
||||||
|
regex: '\\[|\\('},
|
||||||
|
{ token: [ 'text', 'keyword.operator.transposed-matrix.julia' ],
|
||||||
|
regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ],
|
||||||
|
'#string':
|
||||||
|
[ { token: 'punctuation.definition.string.begin.julia',
|
||||||
|
regex: '\'',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.julia',
|
||||||
|
regex: '\'',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#string_escaped_char' },
|
||||||
|
{ defaultToken: 'string.quoted.single.julia' } ] },
|
||||||
|
{ token: 'punctuation.definition.string.begin.julia',
|
||||||
|
regex: '"',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.julia',
|
||||||
|
regex: '"',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#string_escaped_char' },
|
||||||
|
{ defaultToken: 'string.quoted.double.julia' } ] },
|
||||||
|
{ token: 'punctuation.definition.string.begin.julia',
|
||||||
|
regex: '\\b\\w+"',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.julia',
|
||||||
|
regex: '"\\w*',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#string_custom_escaped_char' },
|
||||||
|
{ defaultToken: 'string.quoted.custom-double.julia' } ] },
|
||||||
|
{ token: 'punctuation.definition.string.begin.julia',
|
||||||
|
regex: '`',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.string.end.julia',
|
||||||
|
regex: '`',
|
||||||
|
next: 'pop' },
|
||||||
|
{ include: '#string_escaped_char' },
|
||||||
|
{ defaultToken: 'string.quoted.backtick.julia' } ] } ],
|
||||||
|
'#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ],
|
||||||
|
'#string_escaped_char':
|
||||||
|
[ { token: 'constant.character.escape.julia',
|
||||||
|
regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ],
|
||||||
|
'#type_decl':
|
||||||
|
[ { token:
|
||||||
|
[ 'keyword.control.type.julia',
|
||||||
|
'meta.type.julia',
|
||||||
|
'entity.name.type.julia',
|
||||||
|
'entity.other.inherited-class.julia',
|
||||||
|
'punctuation.separator.inheritance.julia',
|
||||||
|
'entity.other.inherited-class.julia' ],
|
||||||
|
regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' },
|
||||||
|
{ token: [ 'other.typed-variable.julia', 'support.type.julia' ],
|
||||||
|
regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ],
|
||||||
|
firstLineMatch: '^#!.*\\bjulia\\s*$',
|
||||||
|
foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$',
|
||||||
|
foldingStopMarker: '^\\s*(?:end)\\b.*$',
|
||||||
|
name: 'Julia',
|
||||||
|
scopeName: 'source.julia' }
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(JuliaHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.JuliaHighlightRules = JuliaHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
189
src/main/webapp/assets/ace/mode-latex.js
Normal file
189
src/main/webapp/assets/ace/mode-latex.js
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
ace.define('ace/mode/latex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/latex_highlight_rules', 'ace/mode/folding/latex', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
|
||||||
|
var LatexFoldMode = require("./folding/latex").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LatexHighlightRules;
|
||||||
|
this.foldingRules = new LatexFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "%";
|
||||||
|
|
||||||
|
this.$id = "ace/mode/latex";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/latex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LatexHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [{
|
||||||
|
token : "keyword",
|
||||||
|
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
|
||||||
|
}, {
|
||||||
|
token : "lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "%.*$"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LatexHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LatexHighlightRules = LatexHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.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) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection)\b|{\s*$/;
|
||||||
|
this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.doc.getLine(row);
|
||||||
|
var match = this.foldingStartMarker.exec(line);
|
||||||
|
if (match) {
|
||||||
|
if (match[1])
|
||||||
|
return this.latexBlock(session, row, match[0].length - 1);
|
||||||
|
if (match[2])
|
||||||
|
return this.latexSection(session, row, match[0].length - 1);
|
||||||
|
|
||||||
|
return this.openingBracketBlock(session, "{", row, match.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = this.foldingStopMarker.exec(line);
|
||||||
|
if (match) {
|
||||||
|
if (match[1])
|
||||||
|
return this.latexBlock(session, row, match[0].length - 1);
|
||||||
|
|
||||||
|
return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.latexBlock = function(session, row, column) {
|
||||||
|
var keywords = {
|
||||||
|
"\\begin": 1,
|
||||||
|
"\\end": -1
|
||||||
|
};
|
||||||
|
|
||||||
|
var stream = new TokenIterator(session, row, column);
|
||||||
|
var token = stream.getCurrentToken();
|
||||||
|
if (!token || token.type !== "keyword")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var val = token.value;
|
||||||
|
var dir = keywords[val];
|
||||||
|
|
||||||
|
var getType = function() {
|
||||||
|
var token = stream.stepForward();
|
||||||
|
var type = token.type == "lparen" ?stream.stepForward().value : "";
|
||||||
|
if (dir === -1) {
|
||||||
|
stream.stepBackward();
|
||||||
|
if (type)
|
||||||
|
stream.stepBackward();
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
};
|
||||||
|
var stack = [getType()];
|
||||||
|
var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
|
||||||
|
var startRow = row;
|
||||||
|
|
||||||
|
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
|
||||||
|
while(token = stream.step()) {
|
||||||
|
if (token.type !== "keyword")
|
||||||
|
continue;
|
||||||
|
var level = keywords[token.value];
|
||||||
|
if (!level)
|
||||||
|
continue;
|
||||||
|
var type = getType();
|
||||||
|
if (level === dir)
|
||||||
|
stack.unshift(type);
|
||||||
|
else if (stack.shift() !== type || !stack.length)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.length)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var row = stream.getCurrentTokenRow();
|
||||||
|
if (dir === -1)
|
||||||
|
return new Range(row, session.getLine(row).length, startRow, startColumn);
|
||||||
|
stream.stepBackward();
|
||||||
|
return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
|
||||||
|
};
|
||||||
|
|
||||||
|
this.latexSection = function(session, row, column) {
|
||||||
|
var keywords = ["\\subsection", "\\section", "\\begin", "\\end"];
|
||||||
|
|
||||||
|
var stream = new TokenIterator(session, row, column);
|
||||||
|
var token = stream.getCurrentToken();
|
||||||
|
if (!token || token.type != "keyword")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startLevel = keywords.indexOf(token.value);
|
||||||
|
var stackDepth = 0
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while(token = stream.stepForward()) {
|
||||||
|
if (token.type !== "keyword")
|
||||||
|
continue;
|
||||||
|
var level = keywords.indexOf(token.value);
|
||||||
|
|
||||||
|
if (level >= 2) {
|
||||||
|
if (!stackDepth)
|
||||||
|
endRow = stream.getCurrentTokenRow() - 1;
|
||||||
|
stackDepth += level == 2 ? 1 : - 1;
|
||||||
|
if (stackDepth < 0)
|
||||||
|
break
|
||||||
|
} else if (level >= startLevel)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stackDepth)
|
||||||
|
endRow = stream.getCurrentTokenRow() - 1;
|
||||||
|
|
||||||
|
while (endRow > row && !/\S/.test(session.getLine(endRow)))
|
||||||
|
endRow--;
|
||||||
|
|
||||||
|
return new Range(
|
||||||
|
row, session.getLine(row).length,
|
||||||
|
endRow, session.getLine(endRow).length
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
883
src/main/webapp/assets/ace/mode-less.js
Normal file
883
src/main/webapp/assets/ace/mode-less.js
Normal file
@@ -0,0 +1,883 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/less', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/less_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LessHighlightRules;
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CssBehaviour();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = line.match(/^.*\{\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/less";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LessHighlightRules = function() {
|
||||||
|
|
||||||
|
var properties = lang.arrayToMap( (function () {
|
||||||
|
|
||||||
|
var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
|
||||||
|
|
||||||
|
var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
|
||||||
|
"background-size|binding|border-bottom-colors|border-left-colors|" +
|
||||||
|
"border-right-colors|border-top-colors|border-end|border-end-color|" +
|
||||||
|
"border-end-style|border-end-width|border-image|border-start|" +
|
||||||
|
"border-start-color|border-start-style|border-start-width|box-align|" +
|
||||||
|
"box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
|
||||||
|
"box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
|
||||||
|
"column-rule-width|column-rule-style|column-rule-color|float-edge|" +
|
||||||
|
"font-feature-settings|font-language-override|force-broken-image-icon|" +
|
||||||
|
"image-region|margin-end|margin-start|opacity|outline|outline-color|" +
|
||||||
|
"outline-offset|outline-radius|outline-radius-bottomleft|" +
|
||||||
|
"outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
|
||||||
|
"outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
|
||||||
|
"tab-size|text-blink|text-decoration-color|text-decoration-line|" +
|
||||||
|
"text-decoration-style|transform|transform-origin|transition|" +
|
||||||
|
"transition-delay|transition-duration|transition-property|" +
|
||||||
|
"transition-timing-function|user-focus|user-input|user-modify|user-select|" +
|
||||||
|
"window-shadow|border-radius").split("|");
|
||||||
|
|
||||||
|
var properties = ("azimuth|background-attachment|background-color|background-image|" +
|
||||||
|
"background-position|background-repeat|background|border-bottom-color|" +
|
||||||
|
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
||||||
|
"border-color|border-left-color|border-left-style|border-left-width|" +
|
||||||
|
"border-left|border-right-color|border-right-style|border-right-width|" +
|
||||||
|
"border-right|border-spacing|border-style|border-top-color|" +
|
||||||
|
"border-top-style|border-top-width|border-top|border-width|border|" +
|
||||||
|
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
||||||
|
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
||||||
|
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
||||||
|
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
||||||
|
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
||||||
|
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
||||||
|
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
||||||
|
"min-width|opacity|orphans|outline-color|" +
|
||||||
|
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
||||||
|
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
||||||
|
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
||||||
|
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
|
||||||
|
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
||||||
|
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
||||||
|
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
|
||||||
|
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
||||||
|
"z-index").split("|");
|
||||||
|
var ret = [];
|
||||||
|
for (var i=0, ln=browserPrefix.length; i<ln; i++) {
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
ret,
|
||||||
|
(( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Array.prototype.push.apply(ret, prefixProperties);
|
||||||
|
Array.prototype.push.apply(ret, properties);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
})() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var functions = lang.arrayToMap(
|
||||||
|
("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
|
||||||
|
"desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
|
||||||
|
"alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
|
||||||
|
"iskeyword|isurl|ispixel|ispercentage|isem").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var constants = lang.arrayToMap(
|
||||||
|
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
||||||
|
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
||||||
|
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
||||||
|
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
||||||
|
"distribute-all-lines|distribute-letter|distribute-space|" +
|
||||||
|
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
||||||
|
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
||||||
|
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
||||||
|
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
||||||
|
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
||||||
|
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
||||||
|
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
||||||
|
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
||||||
|
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
||||||
|
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
||||||
|
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
||||||
|
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
||||||
|
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
||||||
|
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
||||||
|
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
||||||
|
"zero").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var colors = lang.arrayToMap(
|
||||||
|
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
||||||
|
"purple|red|silver|teal|white|yellow").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywords = lang.arrayToMap(
|
||||||
|
("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
|
||||||
|
"@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
|
||||||
|
"def|end|declare|when|not|and").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var tags = lang.arrayToMap(
|
||||||
|
("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
|
||||||
|
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
|
||||||
|
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
|
||||||
|
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
|
||||||
|
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
|
||||||
|
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
|
||||||
|
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
|
||||||
|
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
|
||||||
|
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex6 color
|
||||||
|
regex : "#[a-f0-9]{6}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex3 color
|
||||||
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else
|
||||||
|
return "variable";
|
||||||
|
},
|
||||||
|
regex : "@[a-z0-9_\\-@]*\\b"
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (properties.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.type";
|
||||||
|
else if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else if (constants.hasOwnProperty(value))
|
||||||
|
return "constant.language";
|
||||||
|
else if (functions.hasOwnProperty(value))
|
||||||
|
return "support.function";
|
||||||
|
else if (colors.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.constant.color";
|
||||||
|
else if (tags.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "variable.language";
|
||||||
|
else
|
||||||
|
return "text";
|
||||||
|
},
|
||||||
|
regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "#[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "\\.[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: ":[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
caseInsensitive: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LessHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LessHighlightRules = LessHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
var CssBehaviour = function () {
|
||||||
|
|
||||||
|
this.inherit(CstyleBehaviour);
|
||||||
|
|
||||||
|
this.add("colon", "insertion", function (state, action, editor, session, text) {
|
||||||
|
if (text === ':') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
if (token && token.value.match(/\s+/)) {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
}
|
||||||
|
if (token && token.type === 'support.type') {
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === ':') {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
||||||
|
return {
|
||||||
|
text: ':;',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("colon", "deletion", function (state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected === ':') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
if (token && token.value.match(/\s+/)) {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
}
|
||||||
|
if (token && token.type === 'support.type') {
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar === ';') {
|
||||||
|
range.end.column ++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("semicolon", "insertion", function (state, action, editor, session, text) {
|
||||||
|
if (text === ';') {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === ';') {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
oop.inherits(CssBehaviour, CstyleBehaviour);
|
||||||
|
|
||||||
|
exports.CssBehaviour = CssBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1003
src/main/webapp/assets/ace/mode-liquid.js
Normal file
1003
src/main/webapp/assets/ace/mode-liquid.js
Normal file
File diff suppressed because it is too large
Load Diff
136
src/main/webapp/assets/ace/mode-lisp.js
Normal file
136
src/main/webapp/assets/ace/mode-lisp.js
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/lisp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/lisp_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LispHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = ";";
|
||||||
|
|
||||||
|
this.$id = "ace/mode/lisp";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ace.define('ace/mode/lisp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LispHighlightRules = function() {
|
||||||
|
var keywordControl = "case|do|let|loop|if|else|when";
|
||||||
|
var keywordOperator = "eq|neq|and|or";
|
||||||
|
var constantLanguage = "null|nil";
|
||||||
|
var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn";
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword.control": keywordControl,
|
||||||
|
"keyword.operator": keywordOperator,
|
||||||
|
"constant.language": constantLanguage,
|
||||||
|
"support.function": supportFunctions
|
||||||
|
}, "identifier", true);
|
||||||
|
|
||||||
|
this.$rules =
|
||||||
|
{
|
||||||
|
"start": [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : ";.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"],
|
||||||
|
regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
|
||||||
|
regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
|
||||||
|
regex: "(\\*)(\\S*)(\\*)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '"(?=.)',
|
||||||
|
next : "qqstring"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring": [
|
||||||
|
{
|
||||||
|
token: "constant.character.escape.lisp",
|
||||||
|
regex: "\\\\."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '[^"\\\\]+'
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "\\\\$",
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"|$',
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LispHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LispHighlightRules = LispHighlightRules;
|
||||||
|
});
|
||||||
289
src/main/webapp/assets/ace/mode-livescript.js
Normal file
289
src/main/webapp/assets/ace/mode-livescript.js
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
ace.define('ace/mode/livescript', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/text'], function(require, exports, module) {
|
||||||
|
var identifier, LiveScriptMode, keywordend, stringfill;
|
||||||
|
identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
|
||||||
|
exports.Mode = LiveScriptMode = (function(superclass){
|
||||||
|
var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
|
||||||
|
function LiveScriptMode(){
|
||||||
|
var that;
|
||||||
|
this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
|
||||||
|
if (that = require('../mode/matching_brace_outdent')) {
|
||||||
|
this.$outdent = new that.MatchingBraceOutdent;
|
||||||
|
}
|
||||||
|
this.$id = "ace/mode/livescript";
|
||||||
|
}
|
||||||
|
indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
|
||||||
|
prototype.getNextLineIndent = function(state, line, tab){
|
||||||
|
var indent, tokens;
|
||||||
|
indent = this.$getIndent(line);
|
||||||
|
tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||||
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
|
||||||
|
if (state === 'start' && indenter.test(line)) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
prototype.toggleCommentLines = function(state, doc, startRow, endRow){
|
||||||
|
var comment, range, i$, i, out, line;
|
||||||
|
comment = /^(\s*)#/;
|
||||||
|
range = new (require('../range')).Range(0, 0, 0, 0);
|
||||||
|
for (i$ = startRow; i$ <= endRow; ++i$) {
|
||||||
|
i = i$;
|
||||||
|
if (out = comment.test(line = doc.getLine(i))) {
|
||||||
|
line = line.replace(comment, '$1');
|
||||||
|
} else {
|
||||||
|
line = line.replace(/^\s*/, '$&#');
|
||||||
|
}
|
||||||
|
range.end.row = range.start.row = i;
|
||||||
|
range.end.column = line.length + 1;
|
||||||
|
doc.replace(range, line);
|
||||||
|
}
|
||||||
|
return 1 - out * 2;
|
||||||
|
};
|
||||||
|
prototype.checkOutdent = function(state, line, input){
|
||||||
|
var ref$;
|
||||||
|
return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
|
||||||
|
};
|
||||||
|
prototype.autoOutdent = function(state, doc, row){
|
||||||
|
var ref$;
|
||||||
|
return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
|
||||||
|
};
|
||||||
|
return LiveScriptMode;
|
||||||
|
}(require('../mode/text').Mode));
|
||||||
|
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
|
||||||
|
stringfill = {
|
||||||
|
token: 'string',
|
||||||
|
regex: '.+'
|
||||||
|
};
|
||||||
|
LiveScriptMode.Rules = {
|
||||||
|
start: [
|
||||||
|
{
|
||||||
|
token: 'keyword',
|
||||||
|
regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'constant.language',
|
||||||
|
regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'invalid.illegal',
|
||||||
|
regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'language.support.class',
|
||||||
|
regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'language.support.function',
|
||||||
|
regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'variable.language',
|
||||||
|
regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
|
||||||
|
}, {
|
||||||
|
token: 'identifier',
|
||||||
|
regex: identifier + '\\s*:(?![:=])'
|
||||||
|
}, {
|
||||||
|
token: 'variable',
|
||||||
|
regex: identifier
|
||||||
|
}, {
|
||||||
|
token: 'keyword.operator',
|
||||||
|
regex: '(?:\\.{3}|\\s+\\?)'
|
||||||
|
}, {
|
||||||
|
token: 'keyword.variable',
|
||||||
|
regex: '(?:@+|::|\\.\\.)',
|
||||||
|
next: 'key'
|
||||||
|
}, {
|
||||||
|
token: 'keyword.operator',
|
||||||
|
regex: '\\.\\s*',
|
||||||
|
next: 'key'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '\\\\\\S[^\\s,;)}\\]]*'
|
||||||
|
}, {
|
||||||
|
token: 'string.doc',
|
||||||
|
regex: '\'\'\'',
|
||||||
|
next: 'qdoc'
|
||||||
|
}, {
|
||||||
|
token: 'string.doc',
|
||||||
|
regex: '"""',
|
||||||
|
next: 'qqdoc'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '\'',
|
||||||
|
next: 'qstring'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '"',
|
||||||
|
next: 'qqstring'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '`',
|
||||||
|
next: 'js'
|
||||||
|
}, {
|
||||||
|
token: 'string',
|
||||||
|
regex: '<\\[',
|
||||||
|
next: 'words'
|
||||||
|
}, {
|
||||||
|
token: 'string.regex',
|
||||||
|
regex: '//',
|
||||||
|
next: 'heregex'
|
||||||
|
}, {
|
||||||
|
token: 'comment.doc',
|
||||||
|
regex: '/\\*',
|
||||||
|
next: 'comment'
|
||||||
|
}, {
|
||||||
|
token: 'comment',
|
||||||
|
regex: '#.*'
|
||||||
|
}, {
|
||||||
|
token: 'string.regex',
|
||||||
|
regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
|
||||||
|
next: 'key'
|
||||||
|
}, {
|
||||||
|
token: 'constant.numeric',
|
||||||
|
regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
|
||||||
|
}, {
|
||||||
|
token: 'lparen',
|
||||||
|
regex: '[({[]'
|
||||||
|
}, {
|
||||||
|
token: 'rparen',
|
||||||
|
regex: '[)}\\]]',
|
||||||
|
next: 'key'
|
||||||
|
}, {
|
||||||
|
token: 'keyword.operator',
|
||||||
|
regex: '\\S+'
|
||||||
|
}, {
|
||||||
|
token: 'text',
|
||||||
|
regex: '\\s+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
heregex: [
|
||||||
|
{
|
||||||
|
token: 'string.regex',
|
||||||
|
regex: '.*?//[gimy$?]{0,4}',
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'string.regex',
|
||||||
|
regex: '\\s*#{'
|
||||||
|
}, {
|
||||||
|
token: 'comment.regex',
|
||||||
|
regex: '\\s+(?:#.*)?'
|
||||||
|
}, {
|
||||||
|
token: 'string.regex',
|
||||||
|
regex: '\\S+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
key: [
|
||||||
|
{
|
||||||
|
token: 'keyword.operator',
|
||||||
|
regex: '[.?@!]+'
|
||||||
|
}, {
|
||||||
|
token: 'identifier',
|
||||||
|
regex: identifier,
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'text',
|
||||||
|
regex: '.',
|
||||||
|
next: 'start'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
comment: [
|
||||||
|
{
|
||||||
|
token: 'comment.doc',
|
||||||
|
regex: '.*?\\*/',
|
||||||
|
next: 'start'
|
||||||
|
}, {
|
||||||
|
token: 'comment.doc',
|
||||||
|
regex: '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
qdoc: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: ".*?'''",
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
],
|
||||||
|
qqdoc: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: '.*?"""',
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
],
|
||||||
|
qstring: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
],
|
||||||
|
qqstring: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
],
|
||||||
|
js: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
],
|
||||||
|
words: [
|
||||||
|
{
|
||||||
|
token: 'string',
|
||||||
|
regex: '.*?\\]>',
|
||||||
|
next: 'key'
|
||||||
|
}, stringfill
|
||||||
|
]
|
||||||
|
};
|
||||||
|
function extend$(sub, sup){
|
||||||
|
function fun(){} fun.prototype = (sub.superclass = sup).prototype;
|
||||||
|
(sub.prototype = new fun).constructor = sub;
|
||||||
|
if (typeof sup.extended == 'function') sup.extended(sub);
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
function import$(obj, src){
|
||||||
|
var own = {}.hasOwnProperty;
|
||||||
|
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
698
src/main/webapp/assets/ace/mode-logiql.js
Normal file
698
src/main/webapp/assets/ace/mode-logiql.js
Normal file
@@ -0,0 +1,698 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/logiql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/logiql_highlight_rules', 'ace/mode/folding/coffee', 'ace/token_iterator', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LogiQLHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
if (/comment|string/.test(endState))
|
||||||
|
return indent;
|
||||||
|
if (tokens.length && tokens[tokens.length - 1].type == "comment.single")
|
||||||
|
return indent;
|
||||||
|
|
||||||
|
var match = line.match();
|
||||||
|
if (/(-->|<--|<-|->|{)\s*$/.test(line))
|
||||||
|
indent += tab;
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
if (this.$outdent.checkOutdent(line, input))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (input !== "\n" && input !== "\r\n")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!/^\s+/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
if (this.$outdent.autoOutdent(doc, row))
|
||||||
|
return;
|
||||||
|
var prevLine = doc.getLine(row);
|
||||||
|
var match = prevLine.match(/^\s+/);
|
||||||
|
var column = prevLine.lastIndexOf(".") + 1;
|
||||||
|
if (!match || !row || !column) return 0;
|
||||||
|
|
||||||
|
var line = doc.getLine(row + 1);
|
||||||
|
var startRange = this.getMatching(doc, {row: row, column: column});
|
||||||
|
if (!startRange || startRange.start.row == row) return 0;
|
||||||
|
|
||||||
|
column = match[0].length;
|
||||||
|
var indent = this.$getIndent(doc.getLine(startRange.start.row));
|
||||||
|
doc.replace(new Range(row + 1, 0, row + 1, column), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getMatching = function(session, row, column) {
|
||||||
|
if (row == undefined)
|
||||||
|
row = session.selection.lead
|
||||||
|
if (typeof row == "object") {
|
||||||
|
column = row.column;
|
||||||
|
row = row.row;
|
||||||
|
}
|
||||||
|
|
||||||
|
var startToken = session.getTokenAt(row, column);
|
||||||
|
var KW_START = "keyword.start", KW_END = "keyword.end";
|
||||||
|
var tok;
|
||||||
|
if (!startToken)
|
||||||
|
return;
|
||||||
|
if (startToken.type == KW_START) {
|
||||||
|
var it = new TokenIterator(session, row, column);
|
||||||
|
it.step = it.stepForward;
|
||||||
|
} else if (startToken.type == KW_END) {
|
||||||
|
var it = new TokenIterator(session, row, column);
|
||||||
|
it.step = it.stepBackward;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (tok = it.step()) {
|
||||||
|
if (tok.type == KW_START || tok.type == KW_END)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!tok || tok.type == startToken.type)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var col = it.getCurrentTokenColumn();
|
||||||
|
var row = it.getCurrentTokenRow();
|
||||||
|
return new Range(row, col, row, col + tok.value.length);
|
||||||
|
};
|
||||||
|
this.$id = "ace/mode/logiql";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/logiql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LogiQLHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { token: 'comment.block',
|
||||||
|
regex: '/\\*',
|
||||||
|
push:
|
||||||
|
[ { token: 'comment.block', regex: '\\*/', next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block' } ],
|
||||||
|
},
|
||||||
|
{ token: 'comment.single',
|
||||||
|
regex: '//.*',
|
||||||
|
},
|
||||||
|
{ token: 'constant.numeric',
|
||||||
|
regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?',
|
||||||
|
},
|
||||||
|
{ token: 'string',
|
||||||
|
regex: '"',
|
||||||
|
push:
|
||||||
|
[ { token: 'string', regex: '"', next: 'pop' },
|
||||||
|
{ defaultToken: 'string' } ],
|
||||||
|
},
|
||||||
|
{ token: 'constant.language',
|
||||||
|
regex: '\\b(true|false)\\b',
|
||||||
|
},
|
||||||
|
{ token: 'entity.name.type.logicblox',
|
||||||
|
regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b',
|
||||||
|
},
|
||||||
|
{ token: 'keyword.start', regex: '->', comment: 'Constraint' },
|
||||||
|
{ token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'},
|
||||||
|
{ token: 'keyword.start', regex: '<-', comment: 'Rule' },
|
||||||
|
{ token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' },
|
||||||
|
{ token: 'keyword.end', regex: '\\.', comment: 'Terminator' },
|
||||||
|
{ token: 'keyword.other', regex: '!', comment: 'Negation' },
|
||||||
|
{ token: 'keyword.other', regex: ',', comment: 'Conjunction' },
|
||||||
|
{ token: 'keyword.other', regex: ';', comment: 'Disjunction' },
|
||||||
|
{ token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'},
|
||||||
|
{ token: 'keyword.other', regex: '@', comment: 'Equality' },
|
||||||
|
{ token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'},
|
||||||
|
{ token: 'keyword', regex: '::', comment: 'Colon colon' },
|
||||||
|
{ token: 'support.function',
|
||||||
|
regex: '\\b(agg\\s*<<)',
|
||||||
|
push:
|
||||||
|
[ { include: '$self' },
|
||||||
|
{ token: 'support.function',
|
||||||
|
regex: '>>',
|
||||||
|
next: 'pop' } ],
|
||||||
|
},
|
||||||
|
{ token: 'storage.modifier',
|
||||||
|
regex: '\\b(lang:[\\w:]*)',
|
||||||
|
},
|
||||||
|
{ token: [ 'storage.type', 'text' ],
|
||||||
|
regex: '(export|sealed|clauses|block|alias|alias_all)(\\s*\\()(?=`)',
|
||||||
|
},
|
||||||
|
{ token: 'entity.name',
|
||||||
|
regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))',
|
||||||
|
},
|
||||||
|
{ token: 'variable.parameter',
|
||||||
|
regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))',
|
||||||
|
} ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LogiQLHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LogiQLHighlightRules = LogiQLHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
679
src/main/webapp/assets/ace/mode-lsl.js
Normal file
679
src/main/webapp/assets/ace/mode-lsl.js
Normal file
File diff suppressed because one or more lines are too long
456
src/main/webapp/assets/ace/mode-lua.js
Normal file
456
src/main/webapp/assets/ace/mode-lua.js
Normal file
@@ -0,0 +1,456 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/lua_highlight_rules', 'ace/mode/folding/lua', 'ace/range', 'ace/worker/worker_client'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
||||||
|
var LuaFoldMode = require("./folding/lua").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LuaHighlightRules;
|
||||||
|
|
||||||
|
this.foldingRules = new LuaFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
this.blockComment = {start: "--[", end: "]--"};
|
||||||
|
|
||||||
|
var indentKeywords = {
|
||||||
|
"function": 1,
|
||||||
|
"then": 1,
|
||||||
|
"do": 1,
|
||||||
|
"else": 1,
|
||||||
|
"elseif": 1,
|
||||||
|
"repeat": 1,
|
||||||
|
"end": -1,
|
||||||
|
"until": -1
|
||||||
|
};
|
||||||
|
var outdentKeywords = [
|
||||||
|
"else",
|
||||||
|
"elseif",
|
||||||
|
"end",
|
||||||
|
"until"
|
||||||
|
];
|
||||||
|
|
||||||
|
function getNetIndentLevel(tokens) {
|
||||||
|
var level = 0;
|
||||||
|
for (var i = 0; i < tokens.length; i++) {
|
||||||
|
var token = tokens[i];
|
||||||
|
if (token.type == "keyword") {
|
||||||
|
if (token.value in indentKeywords) {
|
||||||
|
level += indentKeywords[token.value];
|
||||||
|
}
|
||||||
|
} else if (token.type == "paren.lparen") {
|
||||||
|
level ++;
|
||||||
|
} else if (token.type == "paren.rparen") {
|
||||||
|
level --;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (level < 0) {
|
||||||
|
return -1;
|
||||||
|
} else if (level > 0) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var level = 0;
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
level = getNetIndentLevel(tokens);
|
||||||
|
}
|
||||||
|
if (level > 0) {
|
||||||
|
return indent + tab;
|
||||||
|
} else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
|
||||||
|
if (!this.checkOutdent(state, line, "\n")) {
|
||||||
|
return indent.substr(0, indent.length - tab.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
if (input != "\n" && input != "\r" && input != "\r\n")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (line.match(/^\s*[\)\}\]]$/))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
|
if (!tokens || !tokens.length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, session, row) {
|
||||||
|
var prevLine = session.getLine(row - 1);
|
||||||
|
var prevIndent = this.$getIndent(prevLine).length;
|
||||||
|
var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
|
||||||
|
var tabLength = session.getTabString().length;
|
||||||
|
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
|
||||||
|
var curIndent = this.$getIndent(session.getLine(row)).length;
|
||||||
|
if (curIndent < expectedIndent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
session.outdentRows(new Range(row, 0, row + 2, 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/lua";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LuaHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"break|do|else|elseif|end|for|function|if|in|local|repeat|"+
|
||||||
|
"return|then|until|while|or|and|not"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = ("true|false|nil|_G|_VERSION");
|
||||||
|
|
||||||
|
var functions = (
|
||||||
|
"string|xpcall|package|tostring|print|os|unpack|require|"+
|
||||||
|
"getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
|
||||||
|
"collectgarbage|getmetatable|module|rawset|math|debug|"+
|
||||||
|
"pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
|
||||||
|
"pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+
|
||||||
|
"load|error|loadfile|"+
|
||||||
|
|
||||||
|
"sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+
|
||||||
|
"reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+
|
||||||
|
"loaders|cpath|config|path|seeall|exit|setlocale|date|"+
|
||||||
|
"getenv|difftime|remove|time|clock|tmpname|rename|execute|"+
|
||||||
|
"lines|write|close|flush|open|output|type|read|stderr|"+
|
||||||
|
"stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+
|
||||||
|
"ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+
|
||||||
|
"frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+
|
||||||
|
"atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+
|
||||||
|
"gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
|
||||||
|
"setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
|
||||||
|
"foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
|
||||||
|
"status|wrap|create|running|"+
|
||||||
|
"__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
|
||||||
|
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
|
||||||
|
);
|
||||||
|
|
||||||
|
var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
|
||||||
|
|
||||||
|
var futureReserved = "";
|
||||||
|
|
||||||
|
var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"support.function": functions,
|
||||||
|
"invalid.deprecated": deprecatedIn5152,
|
||||||
|
"constant.library": stdLibaries,
|
||||||
|
"constant.language": builtinConstants,
|
||||||
|
"invalid.illegal": futureReserved,
|
||||||
|
"variable.language": "self"
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||||
|
var integer = "(?:" + decimalInteger + "|" + hexInteger + ")";
|
||||||
|
|
||||||
|
var fraction = "(?:\\.\\d+)";
|
||||||
|
var intPart = "(?:\\d+)";
|
||||||
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
|
var floatNumber = "(?:" + pointFloat + ")";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [{
|
||||||
|
stateName: "bracketedComment",
|
||||||
|
onMatch : function(value, currentState, stack){
|
||||||
|
stack.unshift(this.next, value.length - 2, currentState);
|
||||||
|
return "comment";
|
||||||
|
},
|
||||||
|
regex : /\-\-\[=*\[/,
|
||||||
|
next : [
|
||||||
|
{
|
||||||
|
onMatch : function(value, currentState, stack) {
|
||||||
|
if (value.length == stack[1]) {
|
||||||
|
stack.shift();
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack.shift();
|
||||||
|
} else {
|
||||||
|
this.next = "";
|
||||||
|
}
|
||||||
|
return "comment";
|
||||||
|
},
|
||||||
|
regex : /\]=*\]/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\-\\-.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stateName: "bracketedString",
|
||||||
|
onMatch : function(value, currentState, stack){
|
||||||
|
stack.unshift(this.next, value.length, currentState);
|
||||||
|
return "comment";
|
||||||
|
},
|
||||||
|
regex : /\[=*\[/,
|
||||||
|
next : [
|
||||||
|
{
|
||||||
|
onMatch : function(value, currentState, stack) {
|
||||||
|
if (value.length == stack[1]) {
|
||||||
|
stack.shift();
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack.shift();
|
||||||
|
} else {
|
||||||
|
this.next = "";
|
||||||
|
}
|
||||||
|
return "comment";
|
||||||
|
},
|
||||||
|
|
||||||
|
regex : /\]=*\]/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '"(?:[^\\\\]|\\\\.)*?"'
|
||||||
|
}, {
|
||||||
|
token : "string", // ' string
|
||||||
|
regex : "'(?:[^\\\\]|\\\\.)*?'"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : floatNumber
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // integer
|
||||||
|
regex : integer + "\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\[\\(\\{]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\]\\)\\}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+|\\w+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
oop.inherits(LuaHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LuaHighlightRules = LuaHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
|
||||||
|
this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
|
||||||
|
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var isStart = this.foldingStartMarker.test(line);
|
||||||
|
var isEnd = this.foldingStopMarker.test(line);
|
||||||
|
|
||||||
|
if (isStart && !isEnd) {
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match[1] == "then" && /\belseif\b/.test(line))
|
||||||
|
return;
|
||||||
|
if (match[1]) {
|
||||||
|
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
||||||
|
return "start";
|
||||||
|
} else if (match[2]) {
|
||||||
|
var type = session.bgTokenizer.getState(row) || "";
|
||||||
|
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
|
||||||
|
return "start";
|
||||||
|
} else {
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match[0] === "end") {
|
||||||
|
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
||||||
|
return "end";
|
||||||
|
} else if (match[0][0] === "]") {
|
||||||
|
var type = session.bgTokenizer.getState(row - 1) || "";
|
||||||
|
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
|
||||||
|
return "end";
|
||||||
|
} else
|
||||||
|
return "end";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.doc.getLine(row);
|
||||||
|
var match = this.foldingStartMarker.exec(line);
|
||||||
|
if (match) {
|
||||||
|
if (match[1])
|
||||||
|
return this.luaBlock(session, row, match.index + 1);
|
||||||
|
|
||||||
|
if (match[2])
|
||||||
|
return session.getCommentFoldRange(row, match.index + 1);
|
||||||
|
|
||||||
|
return this.openingBracketBlock(session, "{", row, match.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = this.foldingStopMarker.exec(line);
|
||||||
|
if (match) {
|
||||||
|
if (match[0] === "end") {
|
||||||
|
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
||||||
|
return this.luaBlock(session, row, match.index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match[0][0] === "]")
|
||||||
|
return session.getCommentFoldRange(row, match.index + 1);
|
||||||
|
|
||||||
|
return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.luaBlock = function(session, row, column) {
|
||||||
|
var stream = new TokenIterator(session, row, column);
|
||||||
|
var indentKeywords = {
|
||||||
|
"function": 1,
|
||||||
|
"do": 1,
|
||||||
|
"then": 1,
|
||||||
|
"elseif": -1,
|
||||||
|
"end": -1,
|
||||||
|
"repeat": 1,
|
||||||
|
"until": -1
|
||||||
|
};
|
||||||
|
|
||||||
|
var token = stream.getCurrentToken();
|
||||||
|
if (!token || token.type != "keyword")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var val = token.value;
|
||||||
|
var stack = [val];
|
||||||
|
var dir = indentKeywords[val];
|
||||||
|
|
||||||
|
if (!dir)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
|
||||||
|
var startRow = row;
|
||||||
|
|
||||||
|
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
|
||||||
|
while(token = stream.step()) {
|
||||||
|
if (token.type !== "keyword")
|
||||||
|
continue;
|
||||||
|
var level = dir * indentKeywords[token.value];
|
||||||
|
|
||||||
|
if (level > 0) {
|
||||||
|
stack.unshift(token.value);
|
||||||
|
} else if (level <= 0) {
|
||||||
|
stack.shift();
|
||||||
|
if (!stack.length && token.value != "elseif")
|
||||||
|
break;
|
||||||
|
if (level === 0)
|
||||||
|
stack.unshift(token.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var row = stream.getCurrentTokenRow();
|
||||||
|
if (dir === -1)
|
||||||
|
return new Range(row, session.getLine(row).length, startRow, startColumn);
|
||||||
|
else
|
||||||
|
return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2804
src/main/webapp/assets/ace/mode-luapage.js
Normal file
2804
src/main/webapp/assets/ace/mode-luapage.js
Normal file
File diff suppressed because it is too large
Load Diff
67
src/main/webapp/assets/ace/mode-lucene.js
Normal file
67
src/main/webapp/assets/ace/mode-lucene.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
ace.define('ace/mode/lucene', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/lucene_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = LuceneHighlightRules;
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.$id = "ace/mode/lucene";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});ace.define('ace/mode/lucene_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LuceneHighlightRules = function() {
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "constant.character.negation",
|
||||||
|
regex : "[\\-]"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.interro",
|
||||||
|
regex : "[\\?]"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.asterisk",
|
||||||
|
regex : "[\\*]"
|
||||||
|
}, {
|
||||||
|
token: 'constant.character.proximity',
|
||||||
|
regex: '~[0-9]+\\b'
|
||||||
|
}, {
|
||||||
|
token : 'keyword.operator',
|
||||||
|
regex: '(?:AND|OR|NOT)\\b'
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\(]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\)]"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "[\\S]+:"
|
||||||
|
}, {
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '".*?"'
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LuceneHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LuceneHighlightRules = LuceneHighlightRules;
|
||||||
|
});
|
||||||
331
src/main/webapp/assets/ace/mode-makefile.js
Normal file
331
src/main/webapp/assets/ace/mode-makefile.js
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/makefile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/makefile_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = MakefileHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.$indentWithTabs = true;
|
||||||
|
|
||||||
|
this.$id = "ace/mode/makefile";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});ace.define('ace/mode/makefile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/sh_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var ShHighlightFile = require("./sh_highlight_rules");
|
||||||
|
|
||||||
|
var MakefileHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": ShHighlightFile.reservedKeywords,
|
||||||
|
"support.function.builtin": ShHighlightFile.languageConstructs,
|
||||||
|
"invalid.deprecated": "debugger"
|
||||||
|
}, "string");
|
||||||
|
|
||||||
|
this.$rules =
|
||||||
|
{
|
||||||
|
"start": [
|
||||||
|
{
|
||||||
|
token: "string.interpolated.backtick.makefile",
|
||||||
|
regex: "`",
|
||||||
|
next: "shell-start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "punctuation.definition.comment.makefile",
|
||||||
|
regex: /#(?=.)/,
|
||||||
|
next: "comment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: [ "keyword.control.makefile"],
|
||||||
|
regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"
|
||||||
|
},
|
||||||
|
{// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.*
|
||||||
|
token: ["entity.name.function.makefile", "text"],
|
||||||
|
regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment": [
|
||||||
|
{
|
||||||
|
token : "punctuation.definition.comment.makefile",
|
||||||
|
regex : /.+\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "punctuation.definition.comment.makefile",
|
||||||
|
regex : ".+",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"shell-start": [
|
||||||
|
{
|
||||||
|
token: keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "string",
|
||||||
|
regex : "\\w+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string.interpolated.backtick.makefile",
|
||||||
|
regex : "`",
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(MakefileHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.MakefileHighlightRules = MakefileHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var reservedKeywords = exports.reservedKeywords = (
|
||||||
|
'!|{|}|case|do|done|elif|else|'+
|
||||||
|
'esac|fi|for|if|in|then|until|while|'+
|
||||||
|
'&|;|export|local|read|typeset|unset|'+
|
||||||
|
'elif|select|set'
|
||||||
|
);
|
||||||
|
|
||||||
|
var languageConstructs = exports.languageConstructs = (
|
||||||
|
'[|]|alias|bg|bind|break|builtin|'+
|
||||||
|
'cd|command|compgen|complete|continue|'+
|
||||||
|
'dirs|disown|echo|enable|eval|exec|'+
|
||||||
|
'exit|fc|fg|getopts|hash|help|history|'+
|
||||||
|
'jobs|kill|let|logout|popd|printf|pushd|'+
|
||||||
|
'pwd|return|set|shift|shopt|source|'+
|
||||||
|
'suspend|test|times|trap|type|ulimit|'+
|
||||||
|
'umask|unalias|wait'
|
||||||
|
);
|
||||||
|
|
||||||
|
var ShHighlightRules = function() {
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": reservedKeywords,
|
||||||
|
"support.function.builtin": languageConstructs,
|
||||||
|
"invalid.deprecated": "debugger"
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var integer = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
|
|
||||||
|
var fraction = "(?:\\.\\d+)";
|
||||||
|
var intPart = "(?:\\d+)";
|
||||||
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
|
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
|
||||||
|
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||||
|
var fileDescriptor = "(?:&" + intPart + ")";
|
||||||
|
|
||||||
|
var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
|
||||||
|
var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
|
||||||
|
|
||||||
|
var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
|
||||||
|
|
||||||
|
var func = "(?:" + variableName + "\\s*\\(\\))";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [{
|
||||||
|
token : "constant",
|
||||||
|
regex : /\\./
|
||||||
|
}, {
|
||||||
|
token : ["text", "comment"],
|
||||||
|
regex : /(^|\s)(#.*)$/
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
push : [{
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
|
||||||
|
}, {
|
||||||
|
token : "constant",
|
||||||
|
regex : /\$\w+/
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token : "variable.language",
|
||||||
|
regex : builtinVariable
|
||||||
|
}, {
|
||||||
|
token : "variable",
|
||||||
|
regex : variable
|
||||||
|
}, {
|
||||||
|
token : "support.function",
|
||||||
|
regex : func
|
||||||
|
}, {
|
||||||
|
token : "support.function",
|
||||||
|
regex : fileDescriptor
|
||||||
|
}, {
|
||||||
|
token : "string", // ' string
|
||||||
|
start : "'", end : "'"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : floatNumber
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // integer
|
||||||
|
regex : integer + "\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\[\\(\\{]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\]\\)\\}]"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(ShHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ShHighlightRules = ShHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
2703
src/main/webapp/assets/ace/mode-markdown.js
Normal file
2703
src/main/webapp/assets/ace/mode-markdown.js
Normal file
File diff suppressed because it is too large
Load Diff
229
src/main/webapp/assets/ace/mode-matlab.js
Normal file
229
src/main/webapp/assets/ace/mode-matlab.js
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/matlab', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/matlab_highlight_rules', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRules;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = MatlabHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "%";
|
||||||
|
this.blockComment = {start: "%{", end: "%}"};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/matlab";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matlab_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var MatlabHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|"+
|
||||||
|
"airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|" +
|
||||||
|
"audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|"+
|
||||||
|
"bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|"+
|
||||||
|
"bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|"+
|
||||||
|
"camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:\.(?:close|closeVar|"+
|
||||||
|
"computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|"+
|
||||||
|
"getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|"+
|
||||||
|
"getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|"+
|
||||||
|
"getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|"+
|
||||||
|
"getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|"+
|
||||||
|
"hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|"+
|
||||||
|
"renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|"+
|
||||||
|
"setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|"+
|
||||||
|
"cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|"+
|
||||||
|
"clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|"+
|
||||||
|
"commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers\.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|"+
|
||||||
|
"copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|"+
|
||||||
|
"cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|"+
|
||||||
|
"dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|"+
|
||||||
|
"demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|"+
|
||||||
|
"dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|"+
|
||||||
|
"erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event\.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|"+
|
||||||
|
"expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|"+
|
||||||
|
"fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|"+
|
||||||
|
"findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|"+
|
||||||
|
"frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|"+
|
||||||
|
"get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|"+
|
||||||
|
"guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|"+
|
||||||
|
"hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|"+
|
||||||
|
"hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|"+
|
||||||
|
"ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|"+
|
||||||
|
"1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|"+
|
||||||
|
"isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|"+
|
||||||
|
"isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|"+
|
||||||
|
"isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|"+
|
||||||
|
"lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|"+
|
||||||
|
"linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|"+
|
||||||
|
"lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab\.io\.MatFile|matlab\.mixin\.(?:Copyable|Heterogeneous(?:\.getDefaultScalarElement)?)|matlabrc|"+
|
||||||
|
"matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta\.(?:class(?:\.fromName)?|DynamicProperty|EnumeratedValue|event|"+
|
||||||
|
"MetaData|method|package(?:\.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:\.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|"+
|
||||||
|
"minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|"+
|
||||||
|
"multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|"+
|
||||||
|
"ncwriteschema|ndgrid|ndims|ne|NET(?:\.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|"+
|
||||||
|
"NetException|setStaticProperty))?|netcdf\.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|"+
|
||||||
|
"getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|"+
|
||||||
|
"inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|"+
|
||||||
|
"setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|"+
|
||||||
|
"ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|"+
|
||||||
|
"orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|"+
|
||||||
|
"permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|"+
|
||||||
|
"polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|"+
|
||||||
|
"PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:\.(?:create|"+
|
||||||
|
"getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|"+
|
||||||
|
"rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|"+
|
||||||
|
"restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|"+
|
||||||
|
"saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|"+
|
||||||
|
"setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|"+
|
||||||
|
"spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|"+
|
||||||
|
"str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|"+
|
||||||
|
"strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|"+
|
||||||
|
"support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|"+
|
||||||
|
"textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:\.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|"+
|
||||||
|
"transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|"+
|
||||||
|
"uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|"+
|
||||||
|
"uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|"+
|
||||||
|
"userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:\.isPlatformSupported)?|VideoWriter(?:\.getProfiles)?|"+
|
||||||
|
"view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|"+
|
||||||
|
"what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|"+
|
||||||
|
"ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|"+
|
||||||
|
"pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|"+
|
||||||
|
"cholcov|Classification(?:BaggedEnsemble|Discriminant(?:\.(?:fit|make|template))?|Ensemble|KNN(?:\.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|"+
|
||||||
|
"template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|"+
|
||||||
|
"controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|"+
|
||||||
|
"dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|"+
|
||||||
|
"fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:\.fit)?|geo(?:cdf|inv|mean|"+
|
||||||
|
"pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:\.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|"+
|
||||||
|
"gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|"+
|
||||||
|
"jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|"+
|
||||||
|
"LinearModel(?:\.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|"+
|
||||||
|
"mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:\.fit)?|nan(?:cov|max|mean|median|min|std|"+
|
||||||
|
"sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|"+
|
||||||
|
"nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:\.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|"+
|
||||||
|
"pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|"+
|
||||||
|
"Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|"+
|
||||||
|
"rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|regstats|relieff|ridge|"+
|
||||||
|
"robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|"+
|
||||||
|
"statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|"+
|
||||||
|
"ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest"+
|
||||||
|
"adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|"+
|
||||||
|
"bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|"+
|
||||||
|
"cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|"+
|
||||||
|
"entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|"+
|
||||||
|
"getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|"+
|
||||||
|
"iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|"+
|
||||||
|
"imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|"+
|
||||||
|
"imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|"+
|
||||||
|
"imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|"+
|
||||||
|
"imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|"+
|
||||||
|
"imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|"+
|
||||||
|
"iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|"+
|
||||||
|
"isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|"+
|
||||||
|
"medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|"+
|
||||||
|
"reflect|regionprops|registration\.metric\.(?:MattesMutualInformation|MeanSquares)|registration\.optimizer\.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|"+
|
||||||
|
"rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|"+
|
||||||
|
"warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|"+
|
||||||
|
"linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog"
|
||||||
|
);
|
||||||
|
var storageType = (
|
||||||
|
"cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse"
|
||||||
|
);
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"storage.type": storageType,
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier", true);
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment",
|
||||||
|
regex : "^%[^\r\n]*"
|
||||||
|
}, {
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '".*?"'
|
||||||
|
}, {
|
||||||
|
token : "string", // ' string
|
||||||
|
regex : "'.*?'"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\(]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\)]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(MatlabHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.MatlabHighlightRules = MatlabHighlightRules;
|
||||||
|
});
|
||||||
599
src/main/webapp/assets/ace/mode-mel.js
Normal file
599
src/main/webapp/assets/ace/mode-mel.js
Normal file
File diff suppressed because one or more lines are too long
704
src/main/webapp/assets/ace/mode-mushcode.js
Normal file
704
src/main/webapp/assets/ace/mode-mushcode.js
Normal file
@@ -0,0 +1,704 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/mushcode', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/mushcode_highlight_rules', 'ace/mode/folding/pythonic', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules;
|
||||||
|
var PythonFoldMode = require("./folding/pythonic").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = MushCodeRules;
|
||||||
|
this.foldingRules = new PythonFoldMode("\\:");
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[\:]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
var outdents = {
|
||||||
|
"pass": 1,
|
||||||
|
"return": 1,
|
||||||
|
"raise": 1,
|
||||||
|
"break": 1,
|
||||||
|
"continue": 1
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
if (input !== "\r\n" && input !== "\r" && input !== "\n")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
|
if (!tokens)
|
||||||
|
return false;
|
||||||
|
do {
|
||||||
|
var last = tokens.pop();
|
||||||
|
} while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
|
||||||
|
|
||||||
|
if (!last)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (last.type == "keyword" && outdents[last.value]);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
var indent = this.$getIndent(doc.getLine(row));
|
||||||
|
var tab = doc.getTabString();
|
||||||
|
if (indent.slice(-tab.length) == tab)
|
||||||
|
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/mushcode";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/mushcode_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var MushCodeRules = function() {
|
||||||
|
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"@if|"+
|
||||||
|
"@ifelse|"+
|
||||||
|
"@switch|"+
|
||||||
|
"@halt|"+
|
||||||
|
"@dolist|"+
|
||||||
|
"@create|"+
|
||||||
|
"@scent|"+
|
||||||
|
"@sound|"+
|
||||||
|
"@touch|"+
|
||||||
|
"@ataste|"+
|
||||||
|
"@osound|"+
|
||||||
|
"@ahear|"+
|
||||||
|
"@aahear|"+
|
||||||
|
"@amhear|"+
|
||||||
|
"@otouch|"+
|
||||||
|
"@otaste|"+
|
||||||
|
"@drop|"+
|
||||||
|
"@odrop|"+
|
||||||
|
"@adrop|"+
|
||||||
|
"@dropfail|"+
|
||||||
|
"@odropfail|"+
|
||||||
|
"@smell|"+
|
||||||
|
"@oemit|"+
|
||||||
|
"@emit|"+
|
||||||
|
"@pemit|"+
|
||||||
|
"@parent|"+
|
||||||
|
"@clone|"+
|
||||||
|
"@taste|"+
|
||||||
|
"whisper|"+
|
||||||
|
"page|"+
|
||||||
|
"say|"+
|
||||||
|
"pose|"+
|
||||||
|
"semipose|"+
|
||||||
|
"teach|"+
|
||||||
|
"touch|"+
|
||||||
|
"taste|"+
|
||||||
|
"smell|"+
|
||||||
|
"listen|"+
|
||||||
|
"look|"+
|
||||||
|
"move|"+
|
||||||
|
"go|"+
|
||||||
|
"home|"+
|
||||||
|
"follow|"+
|
||||||
|
"unfollow|"+
|
||||||
|
"desert|"+
|
||||||
|
"dismiss|"+
|
||||||
|
"@tel"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"=#0"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"default|"+
|
||||||
|
"edefault|"+
|
||||||
|
"eval|"+
|
||||||
|
"get_eval|"+
|
||||||
|
"get|"+
|
||||||
|
"grep|"+
|
||||||
|
"grepi|"+
|
||||||
|
"hasattr|"+
|
||||||
|
"hasattrp|"+
|
||||||
|
"hasattrval|"+
|
||||||
|
"hasattrpval|"+
|
||||||
|
"lattr|"+
|
||||||
|
"nattr|"+
|
||||||
|
"poss|"+
|
||||||
|
"udefault|"+
|
||||||
|
"ufun|"+
|
||||||
|
"u|"+
|
||||||
|
"v|"+
|
||||||
|
"uldefault|"+
|
||||||
|
"xget|"+
|
||||||
|
"zfun|"+
|
||||||
|
"band|"+
|
||||||
|
"bnand|"+
|
||||||
|
"bnot|"+
|
||||||
|
"bor|"+
|
||||||
|
"bxor|"+
|
||||||
|
"shl|"+
|
||||||
|
"shr|"+
|
||||||
|
"and|"+
|
||||||
|
"cand|"+
|
||||||
|
"cor|"+
|
||||||
|
"eq|"+
|
||||||
|
"gt|"+
|
||||||
|
"gte|"+
|
||||||
|
"lt|"+
|
||||||
|
"lte|"+
|
||||||
|
"nand|"+
|
||||||
|
"neq|"+
|
||||||
|
"nor|"+
|
||||||
|
"not|"+
|
||||||
|
"or|"+
|
||||||
|
"t|"+
|
||||||
|
"xor|"+
|
||||||
|
"con|"+
|
||||||
|
"entrances|"+
|
||||||
|
"exit|"+
|
||||||
|
"followers|"+
|
||||||
|
"home|"+
|
||||||
|
"lcon|"+
|
||||||
|
"lexits|"+
|
||||||
|
"loc|"+
|
||||||
|
"locate|"+
|
||||||
|
"lparent|"+
|
||||||
|
"lsearch|"+
|
||||||
|
"next|"+
|
||||||
|
"num|"+
|
||||||
|
"owner|"+
|
||||||
|
"parent|"+
|
||||||
|
"pmatch|"+
|
||||||
|
"rloc|"+
|
||||||
|
"rnum|"+
|
||||||
|
"room|"+
|
||||||
|
"where|"+
|
||||||
|
"zone|"+
|
||||||
|
"worn|"+
|
||||||
|
"held|"+
|
||||||
|
"carried|"+
|
||||||
|
"acos|"+
|
||||||
|
"asin|"+
|
||||||
|
"atan|"+
|
||||||
|
"ceil|"+
|
||||||
|
"cos|"+
|
||||||
|
"e|"+
|
||||||
|
"exp|"+
|
||||||
|
"fdiv|"+
|
||||||
|
"fmod|"+
|
||||||
|
"floor|"+
|
||||||
|
"log|"+
|
||||||
|
"ln|"+
|
||||||
|
"pi|"+
|
||||||
|
"power|"+
|
||||||
|
"round|"+
|
||||||
|
"sin|"+
|
||||||
|
"sqrt|"+
|
||||||
|
"tan|"+
|
||||||
|
"aposs|"+
|
||||||
|
"andflags|"+
|
||||||
|
"conn|"+
|
||||||
|
"commandssent|"+
|
||||||
|
"controls|"+
|
||||||
|
"doing|"+
|
||||||
|
"elock|"+
|
||||||
|
"findable|"+
|
||||||
|
"flags|"+
|
||||||
|
"fullname|"+
|
||||||
|
"hasflag|"+
|
||||||
|
"haspower|"+
|
||||||
|
"hastype|"+
|
||||||
|
"hidden|"+
|
||||||
|
"idle|"+
|
||||||
|
"isbaker|"+
|
||||||
|
"lock|"+
|
||||||
|
"lstats|"+
|
||||||
|
"money|"+
|
||||||
|
"who|"+
|
||||||
|
"name|"+
|
||||||
|
"nearby|"+
|
||||||
|
"obj|"+
|
||||||
|
"objflags|"+
|
||||||
|
"photo|"+
|
||||||
|
"poll|"+
|
||||||
|
"powers|"+
|
||||||
|
"pendingtext|"+
|
||||||
|
"receivedtext|"+
|
||||||
|
"restarts|"+
|
||||||
|
"restarttime|"+
|
||||||
|
"subj|"+
|
||||||
|
"shortestpath|"+
|
||||||
|
"tmoney|"+
|
||||||
|
"type|"+
|
||||||
|
"visible|"+
|
||||||
|
"cat|"+
|
||||||
|
"element|"+
|
||||||
|
"elements|"+
|
||||||
|
"extract|"+
|
||||||
|
"filter|"+
|
||||||
|
"filterbool|"+
|
||||||
|
"first|"+
|
||||||
|
"foreach|"+
|
||||||
|
"fold|"+
|
||||||
|
"grab|"+
|
||||||
|
"graball|"+
|
||||||
|
"index|"+
|
||||||
|
"insert|"+
|
||||||
|
"itemize|"+
|
||||||
|
"items|"+
|
||||||
|
"iter|"+
|
||||||
|
"last|"+
|
||||||
|
"ldelete|"+
|
||||||
|
"map|"+
|
||||||
|
"match|"+
|
||||||
|
"matchall|"+
|
||||||
|
"member|"+
|
||||||
|
"mix|"+
|
||||||
|
"munge|"+
|
||||||
|
"pick|"+
|
||||||
|
"remove|"+
|
||||||
|
"replace|"+
|
||||||
|
"rest|"+
|
||||||
|
"revwords|"+
|
||||||
|
"setdiff|"+
|
||||||
|
"setinter|"+
|
||||||
|
"setunion|"+
|
||||||
|
"shuffle|"+
|
||||||
|
"sort|"+
|
||||||
|
"sortby|"+
|
||||||
|
"splice|"+
|
||||||
|
"step|"+
|
||||||
|
"wordpos|"+
|
||||||
|
"words|"+
|
||||||
|
"add|"+
|
||||||
|
"lmath|"+
|
||||||
|
"max|"+
|
||||||
|
"mean|"+
|
||||||
|
"median|"+
|
||||||
|
"min|"+
|
||||||
|
"mul|"+
|
||||||
|
"percent|"+
|
||||||
|
"sign|"+
|
||||||
|
"stddev|"+
|
||||||
|
"sub|"+
|
||||||
|
"val|"+
|
||||||
|
"bound|"+
|
||||||
|
"abs|"+
|
||||||
|
"inc|"+
|
||||||
|
"dec|"+
|
||||||
|
"dist2d|"+
|
||||||
|
"dist3d|"+
|
||||||
|
"div|"+
|
||||||
|
"floordiv|"+
|
||||||
|
"mod|"+
|
||||||
|
"modulo|"+
|
||||||
|
"remainder|"+
|
||||||
|
"vadd|"+
|
||||||
|
"vdim|"+
|
||||||
|
"vdot|"+
|
||||||
|
"vmag|"+
|
||||||
|
"vmax|"+
|
||||||
|
"vmin|"+
|
||||||
|
"vmul|"+
|
||||||
|
"vsub|"+
|
||||||
|
"vunit|"+
|
||||||
|
"regedit|"+
|
||||||
|
"regeditall|"+
|
||||||
|
"regeditalli|"+
|
||||||
|
"regediti|"+
|
||||||
|
"regmatch|"+
|
||||||
|
"regmatchi|"+
|
||||||
|
"regrab|"+
|
||||||
|
"regraball|"+
|
||||||
|
"regraballi|"+
|
||||||
|
"regrabi|"+
|
||||||
|
"regrep|"+
|
||||||
|
"regrepi|"+
|
||||||
|
"after|"+
|
||||||
|
"alphamin|"+
|
||||||
|
"alphamax|"+
|
||||||
|
"art|"+
|
||||||
|
"before|"+
|
||||||
|
"brackets|"+
|
||||||
|
"capstr|"+
|
||||||
|
"case|"+
|
||||||
|
"caseall|"+
|
||||||
|
"center|"+
|
||||||
|
"containsfansi|"+
|
||||||
|
"comp|"+
|
||||||
|
"decompose|"+
|
||||||
|
"decrypt|"+
|
||||||
|
"delete|"+
|
||||||
|
"edit|"+
|
||||||
|
"encrypt|"+
|
||||||
|
"escape|"+
|
||||||
|
"if|"+
|
||||||
|
"ifelse|"+
|
||||||
|
"lcstr|"+
|
||||||
|
"left|"+
|
||||||
|
"lit|"+
|
||||||
|
"ljust|"+
|
||||||
|
"merge|"+
|
||||||
|
"mid|"+
|
||||||
|
"ostrlen|"+
|
||||||
|
"pos|"+
|
||||||
|
"repeat|"+
|
||||||
|
"reverse|"+
|
||||||
|
"right|"+
|
||||||
|
"rjust|"+
|
||||||
|
"scramble|"+
|
||||||
|
"secure|"+
|
||||||
|
"space|"+
|
||||||
|
"spellnum|"+
|
||||||
|
"squish|"+
|
||||||
|
"strcat|"+
|
||||||
|
"strmatch|"+
|
||||||
|
"strinsert|"+
|
||||||
|
"stripansi|"+
|
||||||
|
"stripfansi|"+
|
||||||
|
"strlen|"+
|
||||||
|
"switch|"+
|
||||||
|
"switchall|"+
|
||||||
|
"table|"+
|
||||||
|
"tr|"+
|
||||||
|
"trim|"+
|
||||||
|
"ucstr|"+
|
||||||
|
"unsafe|"+
|
||||||
|
"wrap|"+
|
||||||
|
"ctitle|"+
|
||||||
|
"cwho|"+
|
||||||
|
"channels|"+
|
||||||
|
"clock|"+
|
||||||
|
"cflags|"+
|
||||||
|
"ilev|"+
|
||||||
|
"itext|"+
|
||||||
|
"inum|"+
|
||||||
|
"convsecs|"+
|
||||||
|
"convutcsecs|"+
|
||||||
|
"convtime|"+
|
||||||
|
"ctime|"+
|
||||||
|
"etimefmt|"+
|
||||||
|
"isdaylight|"+
|
||||||
|
"mtime|"+
|
||||||
|
"secs|"+
|
||||||
|
"msecs|"+
|
||||||
|
"starttime|"+
|
||||||
|
"time|"+
|
||||||
|
"timefmt|"+
|
||||||
|
"timestring|"+
|
||||||
|
"utctime|"+
|
||||||
|
"atrlock|"+
|
||||||
|
"clone|"+
|
||||||
|
"create|"+
|
||||||
|
"cook|"+
|
||||||
|
"dig|"+
|
||||||
|
"emit|"+
|
||||||
|
"lemit|"+
|
||||||
|
"link|"+
|
||||||
|
"oemit|"+
|
||||||
|
"open|"+
|
||||||
|
"pemit|"+
|
||||||
|
"remit|"+
|
||||||
|
"set|"+
|
||||||
|
"tel|"+
|
||||||
|
"wipe|"+
|
||||||
|
"zemit|"+
|
||||||
|
"fbcreate|"+
|
||||||
|
"fbdestroy|"+
|
||||||
|
"fbwrite|"+
|
||||||
|
"fbclear|"+
|
||||||
|
"fbcopy|"+
|
||||||
|
"fbcopyto|"+
|
||||||
|
"fbclip|"+
|
||||||
|
"fbdump|"+
|
||||||
|
"fbflush|"+
|
||||||
|
"fbhset|"+
|
||||||
|
"fblist|"+
|
||||||
|
"fbstats|"+
|
||||||
|
"qentries|"+
|
||||||
|
"qentry|"+
|
||||||
|
"play|"+
|
||||||
|
"ansi|"+
|
||||||
|
"break|"+
|
||||||
|
"c|"+
|
||||||
|
"asc|"+
|
||||||
|
"die|"+
|
||||||
|
"isdbref|"+
|
||||||
|
"isint|"+
|
||||||
|
"isnum|"+
|
||||||
|
"isletters|"+
|
||||||
|
"linecoords|"+
|
||||||
|
"localize|"+
|
||||||
|
"lnum|"+
|
||||||
|
"nameshort|"+
|
||||||
|
"null|"+
|
||||||
|
"objeval|"+
|
||||||
|
"r|"+
|
||||||
|
"rand|"+
|
||||||
|
"s|"+
|
||||||
|
"setq|"+
|
||||||
|
"setr|"+
|
||||||
|
"soundex|"+
|
||||||
|
"soundslike|"+
|
||||||
|
"valid|"+
|
||||||
|
"vchart|"+
|
||||||
|
"vchart2|"+
|
||||||
|
"vlabel|"+
|
||||||
|
"@@|"+
|
||||||
|
"bakerdays|"+
|
||||||
|
"bodybuild|"+
|
||||||
|
"box|"+
|
||||||
|
"capall|"+
|
||||||
|
"catalog|"+
|
||||||
|
"children|"+
|
||||||
|
"ctrailer|"+
|
||||||
|
"darttime|"+
|
||||||
|
"debt|"+
|
||||||
|
"detailbar|"+
|
||||||
|
"exploredroom|"+
|
||||||
|
"fansitoansi|"+
|
||||||
|
"fansitoxansi|"+
|
||||||
|
"fullbar|"+
|
||||||
|
"halfbar|"+
|
||||||
|
"isdarted|"+
|
||||||
|
"isnewbie|"+
|
||||||
|
"isword|"+
|
||||||
|
"lambda|"+
|
||||||
|
"lobjects|"+
|
||||||
|
"lplayers|"+
|
||||||
|
"lthings|"+
|
||||||
|
"lvexits|"+
|
||||||
|
"lvobjects|"+
|
||||||
|
"lvplayers|"+
|
||||||
|
"lvthings|"+
|
||||||
|
"newswrap|"+
|
||||||
|
"numsuffix|"+
|
||||||
|
"playerson|"+
|
||||||
|
"playersthisweek|"+
|
||||||
|
"randomad|"+
|
||||||
|
"randword|"+
|
||||||
|
"realrandword|"+
|
||||||
|
"replacechr|"+
|
||||||
|
"second|"+
|
||||||
|
"splitamount|"+
|
||||||
|
"strlenall|"+
|
||||||
|
"text|"+
|
||||||
|
"third|"+
|
||||||
|
"tofansi|"+
|
||||||
|
"totalac|"+
|
||||||
|
"unique|"+
|
||||||
|
"getaddressroom|"+
|
||||||
|
"listpropertycomm|"+
|
||||||
|
"listpropertyres|"+
|
||||||
|
"lotowner|"+
|
||||||
|
"lotrating|"+
|
||||||
|
"lotratingcount|"+
|
||||||
|
"lotvalue|"+
|
||||||
|
"boughtproduct|"+
|
||||||
|
"companyabb|"+
|
||||||
|
"companyicon|"+
|
||||||
|
"companylist|"+
|
||||||
|
"companyname|"+
|
||||||
|
"companyowners|"+
|
||||||
|
"companyvalue|"+
|
||||||
|
"employees|"+
|
||||||
|
"invested|"+
|
||||||
|
"productlist|"+
|
||||||
|
"productname|"+
|
||||||
|
"productowners|"+
|
||||||
|
"productrating|"+
|
||||||
|
"productratingcount|"+
|
||||||
|
"productsoldat|"+
|
||||||
|
"producttype|"+
|
||||||
|
"ratedproduct|"+
|
||||||
|
"soldproduct|"+
|
||||||
|
"topproducts|"+
|
||||||
|
"totalspentonproduct|"+
|
||||||
|
"totalstock|"+
|
||||||
|
"transfermoney|"+
|
||||||
|
"uniquebuyercount|"+
|
||||||
|
"uniqueproductsbought|"+
|
||||||
|
"validcompany|"+
|
||||||
|
"deletepicture|"+
|
||||||
|
"fbsave|"+
|
||||||
|
"getpicturesecurity|"+
|
||||||
|
"haspicture|"+
|
||||||
|
"listpictures|"+
|
||||||
|
"picturesize|"+
|
||||||
|
"replacecolor|"+
|
||||||
|
"rgbtocolor|"+
|
||||||
|
"savepicture|"+
|
||||||
|
"setpicturesecurity|"+
|
||||||
|
"showpicture|"+
|
||||||
|
"piechart|"+
|
||||||
|
"piechartlabel|"+
|
||||||
|
"createmaze|"+
|
||||||
|
"drawmaze|"+
|
||||||
|
"drawwireframe"
|
||||||
|
);
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"invalid.deprecated": "debugger",
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"constant.language": builtinConstants,
|
||||||
|
"keyword": keywords
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||||
|
|
||||||
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
|
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||||
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||||
|
var binInteger = "(?:0[bB][01]+)";
|
||||||
|
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||||
|
|
||||||
|
var exponent = "(?:[eE][+-]?\\d+)";
|
||||||
|
var fraction = "(?:\\.\\d+)";
|
||||||
|
var intPart = "(?:\\d+)";
|
||||||
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
|
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||||
|
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "variable", // mush substitution register
|
||||||
|
regex : "%[0-9]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "variable", // mush substitution register
|
||||||
|
regex : "%q[0-9A-Za-z]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "variable", // mush special character register
|
||||||
|
regex : "%[a-zA-Z]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "%[a-z0-9-_]+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // imaginary
|
||||||
|
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : floatNumber
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // long integer
|
||||||
|
regex : integer + "[lL]\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // integer
|
||||||
|
regex : integer + "\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\[\\(\\{]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\]\\)\\}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(MushCodeRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.MushCodeRules = MushCodeRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/pythonic', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(markers) {
|
||||||
|
this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, match.index);
|
||||||
|
if (match[2])
|
||||||
|
return this.indentationBlock(session, row, match.index + match[2].length);
|
||||||
|
return this.indentationBlock(session, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
569
src/main/webapp/assets/ace/mode-mushcode_high_rules.js
Normal file
569
src/main/webapp/assets/ace/mode-mushcode_high_rules.js
Normal file
@@ -0,0 +1,569 @@
|
|||||||
|
/*
|
||||||
|
* MUSHCodeMode
|
||||||
|
*/
|
||||||
|
|
||||||
|
ace.define('ace/mode/mushcode_high_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var MushCodeRules = function() {
|
||||||
|
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"@if|"+
|
||||||
|
"@ifelse|"+
|
||||||
|
"@switch|"+
|
||||||
|
"@halt|"+
|
||||||
|
"@dolist|"+
|
||||||
|
"@create|"+
|
||||||
|
"@scent|"+
|
||||||
|
"@sound|"+
|
||||||
|
"@touch|"+
|
||||||
|
"@ataste|"+
|
||||||
|
"@osound|"+
|
||||||
|
"@ahear|"+
|
||||||
|
"@aahear|"+
|
||||||
|
"@amhear|"+
|
||||||
|
"@otouch|"+
|
||||||
|
"@otaste|"+
|
||||||
|
"@drop|"+
|
||||||
|
"@odrop|"+
|
||||||
|
"@adrop|"+
|
||||||
|
"@dropfail|"+
|
||||||
|
"@odropfail|"+
|
||||||
|
"@smell|"+
|
||||||
|
"@oemit|"+
|
||||||
|
"@emit|"+
|
||||||
|
"@pemit|"+
|
||||||
|
"@parent|"+
|
||||||
|
"@clone|"+
|
||||||
|
"@taste|"+
|
||||||
|
"whisper|"+
|
||||||
|
"page|"+
|
||||||
|
"say|"+
|
||||||
|
"pose|"+
|
||||||
|
"semipose|"+
|
||||||
|
"teach|"+
|
||||||
|
"touch|"+
|
||||||
|
"taste|"+
|
||||||
|
"smell|"+
|
||||||
|
"listen|"+
|
||||||
|
"look|"+
|
||||||
|
"move|"+
|
||||||
|
"go|"+
|
||||||
|
"home|"+
|
||||||
|
"follow|"+
|
||||||
|
"unfollow|"+
|
||||||
|
"desert|"+
|
||||||
|
"dismiss|"+
|
||||||
|
"@tel"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"=#0"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"default|"+
|
||||||
|
"edefault|"+
|
||||||
|
"eval|"+
|
||||||
|
"get_eval|"+
|
||||||
|
"get|"+
|
||||||
|
"grep|"+
|
||||||
|
"grepi|"+
|
||||||
|
"hasattr|"+
|
||||||
|
"hasattrp|"+
|
||||||
|
"hasattrval|"+
|
||||||
|
"hasattrpval|"+
|
||||||
|
"lattr|"+
|
||||||
|
"nattr|"+
|
||||||
|
"poss|"+
|
||||||
|
"udefault|"+
|
||||||
|
"ufun|"+
|
||||||
|
"u|"+
|
||||||
|
"v|"+
|
||||||
|
"uldefault|"+
|
||||||
|
"xget|"+
|
||||||
|
"zfun|"+
|
||||||
|
"band|"+
|
||||||
|
"bnand|"+
|
||||||
|
"bnot|"+
|
||||||
|
"bor|"+
|
||||||
|
"bxor|"+
|
||||||
|
"shl|"+
|
||||||
|
"shr|"+
|
||||||
|
"and|"+
|
||||||
|
"cand|"+
|
||||||
|
"cor|"+
|
||||||
|
"eq|"+
|
||||||
|
"gt|"+
|
||||||
|
"gte|"+
|
||||||
|
"lt|"+
|
||||||
|
"lte|"+
|
||||||
|
"nand|"+
|
||||||
|
"neq|"+
|
||||||
|
"nor|"+
|
||||||
|
"not|"+
|
||||||
|
"or|"+
|
||||||
|
"t|"+
|
||||||
|
"xor|"+
|
||||||
|
"con|"+
|
||||||
|
"entrances|"+
|
||||||
|
"exit|"+
|
||||||
|
"followers|"+
|
||||||
|
"home|"+
|
||||||
|
"lcon|"+
|
||||||
|
"lexits|"+
|
||||||
|
"loc|"+
|
||||||
|
"locate|"+
|
||||||
|
"lparent|"+
|
||||||
|
"lsearch|"+
|
||||||
|
"next|"+
|
||||||
|
"num|"+
|
||||||
|
"owner|"+
|
||||||
|
"parent|"+
|
||||||
|
"pmatch|"+
|
||||||
|
"rloc|"+
|
||||||
|
"rnum|"+
|
||||||
|
"room|"+
|
||||||
|
"where|"+
|
||||||
|
"zone|"+
|
||||||
|
"worn|"+
|
||||||
|
"held|"+
|
||||||
|
"carried|"+
|
||||||
|
"acos|"+
|
||||||
|
"asin|"+
|
||||||
|
"atan|"+
|
||||||
|
"ceil|"+
|
||||||
|
"cos|"+
|
||||||
|
"e|"+
|
||||||
|
"exp|"+
|
||||||
|
"fdiv|"+
|
||||||
|
"fmod|"+
|
||||||
|
"floor|"+
|
||||||
|
"log|"+
|
||||||
|
"ln|"+
|
||||||
|
"pi|"+
|
||||||
|
"power|"+
|
||||||
|
"round|"+
|
||||||
|
"sin|"+
|
||||||
|
"sqrt|"+
|
||||||
|
"tan|"+
|
||||||
|
"aposs|"+
|
||||||
|
"andflags|"+
|
||||||
|
"conn|"+
|
||||||
|
"commandssent|"+
|
||||||
|
"controls|"+
|
||||||
|
"doing|"+
|
||||||
|
"elock|"+
|
||||||
|
"findable|"+
|
||||||
|
"flags|"+
|
||||||
|
"fullname|"+
|
||||||
|
"hasflag|"+
|
||||||
|
"haspower|"+
|
||||||
|
"hastype|"+
|
||||||
|
"hidden|"+
|
||||||
|
"idle|"+
|
||||||
|
"isbaker|"+
|
||||||
|
"lock|"+
|
||||||
|
"lstats|"+
|
||||||
|
"money|"+
|
||||||
|
"who|"+
|
||||||
|
"name|"+
|
||||||
|
"nearby|"+
|
||||||
|
"obj|"+
|
||||||
|
"objflags|"+
|
||||||
|
"photo|"+
|
||||||
|
"poll|"+
|
||||||
|
"powers|"+
|
||||||
|
"pendingtext|"+
|
||||||
|
"receivedtext|"+
|
||||||
|
"restarts|"+
|
||||||
|
"restarttime|"+
|
||||||
|
"subj|"+
|
||||||
|
"shortestpath|"+
|
||||||
|
"tmoney|"+
|
||||||
|
"type|"+
|
||||||
|
"visible|"+
|
||||||
|
"cat|"+
|
||||||
|
"element|"+
|
||||||
|
"elements|"+
|
||||||
|
"extract|"+
|
||||||
|
"filter|"+
|
||||||
|
"filterbool|"+
|
||||||
|
"first|"+
|
||||||
|
"foreach|"+
|
||||||
|
"fold|"+
|
||||||
|
"grab|"+
|
||||||
|
"graball|"+
|
||||||
|
"index|"+
|
||||||
|
"insert|"+
|
||||||
|
"itemize|"+
|
||||||
|
"items|"+
|
||||||
|
"iter|"+
|
||||||
|
"last|"+
|
||||||
|
"ldelete|"+
|
||||||
|
"map|"+
|
||||||
|
"match|"+
|
||||||
|
"matchall|"+
|
||||||
|
"member|"+
|
||||||
|
"mix|"+
|
||||||
|
"munge|"+
|
||||||
|
"pick|"+
|
||||||
|
"remove|"+
|
||||||
|
"replace|"+
|
||||||
|
"rest|"+
|
||||||
|
"revwords|"+
|
||||||
|
"setdiff|"+
|
||||||
|
"setinter|"+
|
||||||
|
"setunion|"+
|
||||||
|
"shuffle|"+
|
||||||
|
"sort|"+
|
||||||
|
"sortby|"+
|
||||||
|
"splice|"+
|
||||||
|
"step|"+
|
||||||
|
"wordpos|"+
|
||||||
|
"words|"+
|
||||||
|
"add|"+
|
||||||
|
"lmath|"+
|
||||||
|
"max|"+
|
||||||
|
"mean|"+
|
||||||
|
"median|"+
|
||||||
|
"min|"+
|
||||||
|
"mul|"+
|
||||||
|
"percent|"+
|
||||||
|
"sign|"+
|
||||||
|
"stddev|"+
|
||||||
|
"sub|"+
|
||||||
|
"val|"+
|
||||||
|
"bound|"+
|
||||||
|
"abs|"+
|
||||||
|
"inc|"+
|
||||||
|
"dec|"+
|
||||||
|
"dist2d|"+
|
||||||
|
"dist3d|"+
|
||||||
|
"div|"+
|
||||||
|
"floordiv|"+
|
||||||
|
"mod|"+
|
||||||
|
"modulo|"+
|
||||||
|
"remainder|"+
|
||||||
|
"vadd|"+
|
||||||
|
"vdim|"+
|
||||||
|
"vdot|"+
|
||||||
|
"vmag|"+
|
||||||
|
"vmax|"+
|
||||||
|
"vmin|"+
|
||||||
|
"vmul|"+
|
||||||
|
"vsub|"+
|
||||||
|
"vunit|"+
|
||||||
|
"regedit|"+
|
||||||
|
"regeditall|"+
|
||||||
|
"regeditalli|"+
|
||||||
|
"regediti|"+
|
||||||
|
"regmatch|"+
|
||||||
|
"regmatchi|"+
|
||||||
|
"regrab|"+
|
||||||
|
"regraball|"+
|
||||||
|
"regraballi|"+
|
||||||
|
"regrabi|"+
|
||||||
|
"regrep|"+
|
||||||
|
"regrepi|"+
|
||||||
|
"after|"+
|
||||||
|
"alphamin|"+
|
||||||
|
"alphamax|"+
|
||||||
|
"art|"+
|
||||||
|
"before|"+
|
||||||
|
"brackets|"+
|
||||||
|
"capstr|"+
|
||||||
|
"case|"+
|
||||||
|
"caseall|"+
|
||||||
|
"center|"+
|
||||||
|
"containsfansi|"+
|
||||||
|
"comp|"+
|
||||||
|
"decompose|"+
|
||||||
|
"decrypt|"+
|
||||||
|
"delete|"+
|
||||||
|
"edit|"+
|
||||||
|
"encrypt|"+
|
||||||
|
"escape|"+
|
||||||
|
"if|"+
|
||||||
|
"ifelse|"+
|
||||||
|
"lcstr|"+
|
||||||
|
"left|"+
|
||||||
|
"lit|"+
|
||||||
|
"ljust|"+
|
||||||
|
"merge|"+
|
||||||
|
"mid|"+
|
||||||
|
"ostrlen|"+
|
||||||
|
"pos|"+
|
||||||
|
"repeat|"+
|
||||||
|
"reverse|"+
|
||||||
|
"right|"+
|
||||||
|
"rjust|"+
|
||||||
|
"scramble|"+
|
||||||
|
"secure|"+
|
||||||
|
"space|"+
|
||||||
|
"spellnum|"+
|
||||||
|
"squish|"+
|
||||||
|
"strcat|"+
|
||||||
|
"strmatch|"+
|
||||||
|
"strinsert|"+
|
||||||
|
"stripansi|"+
|
||||||
|
"stripfansi|"+
|
||||||
|
"strlen|"+
|
||||||
|
"switch|"+
|
||||||
|
"switchall|"+
|
||||||
|
"table|"+
|
||||||
|
"tr|"+
|
||||||
|
"trim|"+
|
||||||
|
"ucstr|"+
|
||||||
|
"unsafe|"+
|
||||||
|
"wrap|"+
|
||||||
|
"ctitle|"+
|
||||||
|
"cwho|"+
|
||||||
|
"channels|"+
|
||||||
|
"clock|"+
|
||||||
|
"cflags|"+
|
||||||
|
"ilev|"+
|
||||||
|
"itext|"+
|
||||||
|
"inum|"+
|
||||||
|
"convsecs|"+
|
||||||
|
"convutcsecs|"+
|
||||||
|
"convtime|"+
|
||||||
|
"ctime|"+
|
||||||
|
"etimefmt|"+
|
||||||
|
"isdaylight|"+
|
||||||
|
"mtime|"+
|
||||||
|
"secs|"+
|
||||||
|
"msecs|"+
|
||||||
|
"starttime|"+
|
||||||
|
"time|"+
|
||||||
|
"timefmt|"+
|
||||||
|
"timestring|"+
|
||||||
|
"utctime|"+
|
||||||
|
"atrlock|"+
|
||||||
|
"clone|"+
|
||||||
|
"create|"+
|
||||||
|
"cook|"+
|
||||||
|
"dig|"+
|
||||||
|
"emit|"+
|
||||||
|
"lemit|"+
|
||||||
|
"link|"+
|
||||||
|
"oemit|"+
|
||||||
|
"open|"+
|
||||||
|
"pemit|"+
|
||||||
|
"remit|"+
|
||||||
|
"set|"+
|
||||||
|
"tel|"+
|
||||||
|
"wipe|"+
|
||||||
|
"zemit|"+
|
||||||
|
"fbcreate|"+
|
||||||
|
"fbdestroy|"+
|
||||||
|
"fbwrite|"+
|
||||||
|
"fbclear|"+
|
||||||
|
"fbcopy|"+
|
||||||
|
"fbcopyto|"+
|
||||||
|
"fbclip|"+
|
||||||
|
"fbdump|"+
|
||||||
|
"fbflush|"+
|
||||||
|
"fbhset|"+
|
||||||
|
"fblist|"+
|
||||||
|
"fbstats|"+
|
||||||
|
"qentries|"+
|
||||||
|
"qentry|"+
|
||||||
|
"play|"+
|
||||||
|
"ansi|"+
|
||||||
|
"break|"+
|
||||||
|
"c|"+
|
||||||
|
"asc|"+
|
||||||
|
"die|"+
|
||||||
|
"isdbref|"+
|
||||||
|
"isint|"+
|
||||||
|
"isnum|"+
|
||||||
|
"isletters|"+
|
||||||
|
"linecoords|"+
|
||||||
|
"localize|"+
|
||||||
|
"lnum|"+
|
||||||
|
"nameshort|"+
|
||||||
|
"null|"+
|
||||||
|
"objeval|"+
|
||||||
|
"r|"+
|
||||||
|
"rand|"+
|
||||||
|
"s|"+
|
||||||
|
"setq|"+
|
||||||
|
"setr|"+
|
||||||
|
"soundex|"+
|
||||||
|
"soundslike|"+
|
||||||
|
"valid|"+
|
||||||
|
"vchart|"+
|
||||||
|
"vchart2|"+
|
||||||
|
"vlabel|"+
|
||||||
|
"@@|"+
|
||||||
|
"bakerdays|"+
|
||||||
|
"bodybuild|"+
|
||||||
|
"box|"+
|
||||||
|
"capall|"+
|
||||||
|
"catalog|"+
|
||||||
|
"children|"+
|
||||||
|
"ctrailer|"+
|
||||||
|
"darttime|"+
|
||||||
|
"debt|"+
|
||||||
|
"detailbar|"+
|
||||||
|
"exploredroom|"+
|
||||||
|
"fansitoansi|"+
|
||||||
|
"fansitoxansi|"+
|
||||||
|
"fullbar|"+
|
||||||
|
"halfbar|"+
|
||||||
|
"isdarted|"+
|
||||||
|
"isnewbie|"+
|
||||||
|
"isword|"+
|
||||||
|
"lambda|"+
|
||||||
|
"lobjects|"+
|
||||||
|
"lplayers|"+
|
||||||
|
"lthings|"+
|
||||||
|
"lvexits|"+
|
||||||
|
"lvobjects|"+
|
||||||
|
"lvplayers|"+
|
||||||
|
"lvthings|"+
|
||||||
|
"newswrap|"+
|
||||||
|
"numsuffix|"+
|
||||||
|
"playerson|"+
|
||||||
|
"playersthisweek|"+
|
||||||
|
"randomad|"+
|
||||||
|
"randword|"+
|
||||||
|
"realrandword|"+
|
||||||
|
"replacechr|"+
|
||||||
|
"second|"+
|
||||||
|
"splitamount|"+
|
||||||
|
"strlenall|"+
|
||||||
|
"text|"+
|
||||||
|
"third|"+
|
||||||
|
"tofansi|"+
|
||||||
|
"totalac|"+
|
||||||
|
"unique|"+
|
||||||
|
"getaddressroom|"+
|
||||||
|
"listpropertycomm|"+
|
||||||
|
"listpropertyres|"+
|
||||||
|
"lotowner|"+
|
||||||
|
"lotrating|"+
|
||||||
|
"lotratingcount|"+
|
||||||
|
"lotvalue|"+
|
||||||
|
"boughtproduct|"+
|
||||||
|
"companyabb|"+
|
||||||
|
"companyicon|"+
|
||||||
|
"companylist|"+
|
||||||
|
"companyname|"+
|
||||||
|
"companyowners|"+
|
||||||
|
"companyvalue|"+
|
||||||
|
"employees|"+
|
||||||
|
"invested|"+
|
||||||
|
"productlist|"+
|
||||||
|
"productname|"+
|
||||||
|
"productowners|"+
|
||||||
|
"productrating|"+
|
||||||
|
"productratingcount|"+
|
||||||
|
"productsoldat|"+
|
||||||
|
"producttype|"+
|
||||||
|
"ratedproduct|"+
|
||||||
|
"soldproduct|"+
|
||||||
|
"topproducts|"+
|
||||||
|
"totalspentonproduct|"+
|
||||||
|
"totalstock|"+
|
||||||
|
"transfermoney|"+
|
||||||
|
"uniquebuyercount|"+
|
||||||
|
"uniqueproductsbought|"+
|
||||||
|
"validcompany|"+
|
||||||
|
"deletepicture|"+
|
||||||
|
"fbsave|"+
|
||||||
|
"getpicturesecurity|"+
|
||||||
|
"haspicture|"+
|
||||||
|
"listpictures|"+
|
||||||
|
"picturesize|"+
|
||||||
|
"replacecolor|"+
|
||||||
|
"rgbtocolor|"+
|
||||||
|
"savepicture|"+
|
||||||
|
"setpicturesecurity|"+
|
||||||
|
"showpicture|"+
|
||||||
|
"piechart|"+
|
||||||
|
"piechartlabel|"+
|
||||||
|
"createmaze|"+
|
||||||
|
"drawmaze|"+
|
||||||
|
"drawwireframe"
|
||||||
|
);
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"invalid.deprecated": "debugger",
|
||||||
|
"support.function": builtinFunctions,
|
||||||
|
"constant.language": builtinConstants,
|
||||||
|
"keyword": keywords
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||||
|
|
||||||
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
|
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||||
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||||
|
var binInteger = "(?:0[bB][01]+)";
|
||||||
|
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||||
|
|
||||||
|
var exponent = "(?:[eE][+-]?\\d+)";
|
||||||
|
var fraction = "(?:\\.\\d+)";
|
||||||
|
var intPart = "(?:\\d+)";
|
||||||
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
|
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||||
|
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "variable", // mush substitution register
|
||||||
|
regex : "%[0-9]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "variable", // mush substitution register
|
||||||
|
regex : "%q[0-9A-Za-z]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "variable", // mush special character register
|
||||||
|
regex : "%[a-zA-Z]{1}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "%[a-z0-9-_]+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // imaginary
|
||||||
|
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : floatNumber
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // long integer
|
||||||
|
regex : integer + "[lL]\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // integer
|
||||||
|
regex : integer + "\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\[\\(\\{]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\]\\)\\}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(MushCodeRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.MushCodeRules = MushCodeRules;
|
||||||
|
});
|
||||||
184
src/main/webapp/assets/ace/mode-mysql.js
Normal file
184
src/main/webapp/assets/ace/mode-mysql.js
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/mysql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/mysql_highlight_rules', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("../mode/text").Mode;
|
||||||
|
var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = MysqlHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = ["--", "#"]; // todo space
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/mysql";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/mysql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var MysqlHighlightRules = function() {
|
||||||
|
|
||||||
|
var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where" + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat";
|
||||||
|
var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric"
|
||||||
|
var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee"
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"support.function": builtins,
|
||||||
|
"keyword": mySqlKeywords,
|
||||||
|
"constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat",
|
||||||
|
"variable.language": variable
|
||||||
|
}, "identifier", true);
|
||||||
|
|
||||||
|
|
||||||
|
function string(rule) {
|
||||||
|
var start = rule.start;
|
||||||
|
var escapeSeq = rule.escape;
|
||||||
|
return {
|
||||||
|
token: "string.start",
|
||||||
|
regex: start,
|
||||||
|
next: [
|
||||||
|
{token: "constant.language.escape", regex: escapeSeq},
|
||||||
|
{token: "string.end", next: "start", regex: start},
|
||||||
|
{defaultToken: "string"}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment", regex : "(?:-- |#).*$"
|
||||||
|
},
|
||||||
|
string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}),
|
||||||
|
string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}),
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : /\/\*/,
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.class",
|
||||||
|
regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.buildin",
|
||||||
|
regex : "`[^`]*`"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[\\(]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\)]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
} ],
|
||||||
|
"comment" : [
|
||||||
|
{token : "comment", regex : "\\*\\/", next : "start"},
|
||||||
|
{defaultToken : "comment"}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(MysqlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.MysqlHighlightRules = MysqlHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
963
src/main/webapp/assets/ace/mode-nix.js
Normal file
963
src/main/webapp/assets/ace/mode-nix.js
Normal file
@@ -0,0 +1,963 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Zef Hemel
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/nix', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/mode/nix_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var CMode = require("./c_cpp").Mode;
|
||||||
|
var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
CMode.call(this);
|
||||||
|
this.HighlightRules = NixHighlightRules;
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, CMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/nix";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = c_cppHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
var endState = tokenizedLine.state;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
} else if (state == "doc-start") {
|
||||||
|
if (endState == "start") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var match = line.match(/^\s*(\/?)\*/);
|
||||||
|
if (match) {
|
||||||
|
if (match[1]) {
|
||||||
|
indent += " ";
|
||||||
|
}
|
||||||
|
indent += "* ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/c_cpp";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
|
||||||
|
|
||||||
|
var c_cppHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywordControls = (
|
||||||
|
"break|case|continue|default|do|else|for|goto|if|_Pragma|" +
|
||||||
|
"return|switch|while|catch|operator|try|throw|using"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageType = (
|
||||||
|
"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
|
||||||
|
"_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
|
||||||
|
"class|wchar_t|template"
|
||||||
|
);
|
||||||
|
|
||||||
|
var storageModifiers = (
|
||||||
|
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
||||||
|
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordOperators = (
|
||||||
|
"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
|
||||||
|
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = (
|
||||||
|
"NULL|true|false|TRUE|FALSE"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
||||||
|
"keyword.control" : keywordControls,
|
||||||
|
"storage.type" : storageType,
|
||||||
|
"storage.modifier" : storageModifiers,
|
||||||
|
"keyword.operator" : keywordOperators,
|
||||||
|
"variable.language": "this",
|
||||||
|
"constant.language": builtinConstants
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '["].*\\\\$',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : "['].*\\\\$",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // pre-compiler directives
|
||||||
|
regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
|
||||||
|
next : "directive"
|
||||||
|
}, {
|
||||||
|
token : "keyword", // special case pre-compiler directive
|
||||||
|
regex : "(?:#\\s*endif)\\b"
|
||||||
|
}, {
|
||||||
|
token : "support.function.C99.c",
|
||||||
|
regex : cFunctions
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||||
|
}, {
|
||||||
|
token : "punctuation.operator",
|
||||||
|
regex : "\\?|\\:|\\,|\\;|\\."
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directive" : [
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other.multiline",
|
||||||
|
regex : /.*\\/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : "\\s*<.+?>",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other", // single line
|
||||||
|
regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.other",
|
||||||
|
regex : /[^\\\/]+/,
|
||||||
|
next : "start"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [ {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
|
}, {
|
||||||
|
token : "comment.doc.tag",
|
||||||
|
regex : "\\bTODO\\b"
|
||||||
|
}, {
|
||||||
|
defaultToken : "comment.doc"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*(?=\\*)",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||||||
|
return {
|
||||||
|
token : "comment.doc", // closing comment
|
||||||
|
regex : "\\*\\/",
|
||||||
|
next : start
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var lang = require("../../lib/lang");
|
||||||
|
|
||||||
|
var SAFE_INSERT_IN_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator"];
|
||||||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||||||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||||
|
|
||||||
|
var context;
|
||||||
|
var contextCache = {}
|
||||||
|
var initContext = function(editor) {
|
||||||
|
var id = -1;
|
||||||
|
if (editor.multiSelect) {
|
||||||
|
id = editor.selection.id;
|
||||||
|
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||||
|
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||||
|
}
|
||||||
|
if (contextCache[id])
|
||||||
|
return context = contextCache[id];
|
||||||
|
context = contextCache[id] = {
|
||||||
|
autoInsertedBrackets: 0,
|
||||||
|
autoInsertedRow: -1,
|
||||||
|
autoInsertedLineEnd: "",
|
||||||
|
maybeInsertedBrackets: 0,
|
||||||
|
maybeInsertedRow: -1,
|
||||||
|
maybeInsertedLineStart: "",
|
||||||
|
maybeInsertedLineEnd: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var CstyleBehaviour = function() {
|
||||||
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (text == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '{' + selected + '}',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||||
|
return {
|
||||||
|
text: '{}',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||||||
|
return {
|
||||||
|
text: '{',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == '}') {
|
||||||
|
initContext(editor);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
|
initContext(editor);
|
||||||
|
var closing = "";
|
||||||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||||||
|
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar === '}') {
|
||||||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
||||||
|
if (!openBracePos)
|
||||||
|
return null;
|
||||||
|
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
||||||
|
} else if (closing) {
|
||||||
|
var next_indent = this.$getIndent(line);
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var indent = next_indent + session.getTabString();
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||||||
|
selection: [1, indent.length, 1, indent.length]
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '{') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||||
|
if (rightChar == '}') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
} else {
|
||||||
|
context.maybeInsertedBrackets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '(' + selected + ')',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||||
|
return {
|
||||||
|
text: '()',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ')') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '(') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ')') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: '[' + selected + ']',
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||||
|
return {
|
||||||
|
text: '[]',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (text == ']') {
|
||||||
|
initContext(editor);
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && selected == '[') {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == ']') {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||||
|
if (text == '"' || text == "'") {
|
||||||
|
initContext(editor);
|
||||||
|
var quote = text;
|
||||||
|
var selection = editor.getSelectionRange();
|
||||||
|
var selected = session.doc.getTextRange(selection);
|
||||||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||||||
|
return {
|
||||||
|
text: quote + selected + quote,
|
||||||
|
selection: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
if (leftChar == '\\') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = session.getTokens(selection.start.row);
|
||||||
|
var col = 0, token;
|
||||||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||||||
|
|
||||||
|
for (var x = 0; x < tokens.length; x++) {
|
||||||
|
token = tokens[x];
|
||||||
|
if (token.type == "string") {
|
||||||
|
quotepos = -1;
|
||||||
|
} else if (quotepos < 0) {
|
||||||
|
quotepos = token.value.indexOf(quote);
|
||||||
|
}
|
||||||
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
col += tokens[x].value.length;
|
||||||
|
}
|
||||||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
|
return {
|
||||||
|
text: quote + quote,
|
||||||
|
selection: [1,1]
|
||||||
|
};
|
||||||
|
} else if (token && token.type === "string") {
|
||||||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
if (rightChar == quote) {
|
||||||
|
return {
|
||||||
|
text: '',
|
||||||
|
selection: [1, 1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
||||||
|
var selected = session.doc.getTextRange(range);
|
||||||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
|
initContext(editor);
|
||||||
|
var line = session.doc.getLine(range.start.row);
|
||||||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
|
if (rightChar == selected) {
|
||||||
|
range.end.column++;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
iterator.stepForward();
|
||||||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||||||
|
return types.indexOf(token.type || token) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||||
|
context.autoInsertedBrackets = 0;
|
||||||
|
context.autoInsertedRow = cursor.row;
|
||||||
|
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||||
|
context.autoInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||||||
|
var cursor = editor.getCursorPosition();
|
||||||
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = cursor.row;
|
||||||
|
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||||||
|
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
||||||
|
context.maybeInsertedBrackets++;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
|
return context.autoInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
bracket === context.autoInsertedLineEnd[0] &&
|
||||||
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||||||
|
return context.maybeInsertedBrackets > 0 &&
|
||||||
|
cursor.row === context.maybeInsertedRow &&
|
||||||
|
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
||||||
|
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||||||
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
|
context.autoInsertedBrackets--;
|
||||||
|
};
|
||||||
|
|
||||||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||||||
|
if (context) {
|
||||||
|
context.maybeInsertedBrackets = 0;
|
||||||
|
context.maybeInsertedRow = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
|
ace.define('ace/mode/nix_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var NixHighlightRules = function() {
|
||||||
|
|
||||||
|
var constantLanguage = "true|false";
|
||||||
|
var keywordControl = "with|import|if|else|then|inherit";
|
||||||
|
var keywordDeclaration = "let|in|rec";
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"constant.language.nix": constantLanguage,
|
||||||
|
"keyword.control.nix": keywordControl,
|
||||||
|
"keyword.declaration.nix": keywordDeclaration
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start": [{
|
||||||
|
token: "comment",
|
||||||
|
regex: /#.*$/
|
||||||
|
}, {
|
||||||
|
token: "comment",
|
||||||
|
regex: /\/\*/,
|
||||||
|
next: "comment"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "<[^>]+>"
|
||||||
|
}, {
|
||||||
|
regex: "(==|!=|<=?|>=?)",
|
||||||
|
token: ["keyword.operator.comparison.nix"]
|
||||||
|
}, {
|
||||||
|
regex: "((?:[+*/%-]|\\~)=)",
|
||||||
|
token: ["keyword.operator.assignment.arithmetic.nix"]
|
||||||
|
}, {
|
||||||
|
regex: "=",
|
||||||
|
token: "keyword.operator.assignment.nix"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "''",
|
||||||
|
next: "qqdoc"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "'",
|
||||||
|
next: "qstring"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: '"',
|
||||||
|
push: "qqstring"
|
||||||
|
}, {
|
||||||
|
token: "constant.numeric", // hex
|
||||||
|
regex: "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token: "constant.numeric", // float
|
||||||
|
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token: keywordMapper,
|
||||||
|
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
regex: "}",
|
||||||
|
token: function(val, start, stack) {
|
||||||
|
return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text";
|
||||||
|
},
|
||||||
|
next: "pop"
|
||||||
|
}],
|
||||||
|
"comment": [{
|
||||||
|
token: "comment", // closing comment
|
||||||
|
regex: ".*?\\*\\/",
|
||||||
|
next: "start"
|
||||||
|
}, {
|
||||||
|
token: "comment", // comment spanning whole line
|
||||||
|
regex: ".+"
|
||||||
|
}],
|
||||||
|
"qqdoc": [
|
||||||
|
{
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: /\$\{/,
|
||||||
|
push: "start"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "''",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}],
|
||||||
|
"qqstring": [
|
||||||
|
{
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: /\$\{/,
|
||||||
|
push: "start"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: '"',
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}],
|
||||||
|
"qstring": [
|
||||||
|
{
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: /\$\{/,
|
||||||
|
push: "start"
|
||||||
|
}, {
|
||||||
|
token: "string",
|
||||||
|
regex: "'",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(NixHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.NixHighlightRules = NixHighlightRules;
|
||||||
|
});
|
||||||
698
src/main/webapp/assets/ace/mode-objectivec.js
Normal file
698
src/main/webapp/assets/ace/mode-objectivec.js
Normal file
File diff suppressed because one or more lines are too long
444
src/main/webapp/assets/ace/mode-ocaml.js
Normal file
444
src/main/webapp/assets/ace/mode-ocaml.js
Normal file
@@ -0,0 +1,444 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/ocaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/ocaml_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = OcamlHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||||
|
var i, line;
|
||||||
|
var outdent = true;
|
||||||
|
var re = /^\s*\(\*(.*)\*\)/;
|
||||||
|
|
||||||
|
for (i=startRow; i<= endRow; i++) {
|
||||||
|
if (!re.test(doc.getLine(i))) {
|
||||||
|
outdent = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var range = new Range(0, 0, 0, 0);
|
||||||
|
for (i=startRow; i<= endRow; i++) {
|
||||||
|
line = doc.getLine(i);
|
||||||
|
range.start.row = i;
|
||||||
|
range.end.row = i;
|
||||||
|
range.end.column = line.length;
|
||||||
|
|
||||||
|
doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||||
|
|
||||||
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||||
|
state === 'start' && indenter.test(line))
|
||||||
|
indent += tab;
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/ocaml";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/ocaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var OcamlHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
|
||||||
|
"exception|external|for|fun|function|functor|if|in|include|" +
|
||||||
|
"inherit|initializer|lazy|let|match|method|module|mutable|new|" +
|
||||||
|
"object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
|
||||||
|
"virtual|when|while|with"
|
||||||
|
);
|
||||||
|
|
||||||
|
var builtinConstants = ("true|false");
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
|
||||||
|
"add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
|
||||||
|
"add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
|
||||||
|
"add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
|
||||||
|
"allow_unsafe_modules|always|append|appname_get|appname_set|" +
|
||||||
|
"approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" +
|
||||||
|
"array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" +
|
||||||
|
"assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" +
|
||||||
|
"beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" +
|
||||||
|
"bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" +
|
||||||
|
"bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" +
|
||||||
|
"bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" +
|
||||||
|
"cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" +
|
||||||
|
"chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" +
|
||||||
|
"chown|chr|chroot|classify_float|clear|clear_available_units|" +
|
||||||
|
"clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" +
|
||||||
|
"close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" +
|
||||||
|
"close_out|close_out_noerr|close_process|close_process|" +
|
||||||
|
"close_process_full|close_process_in|close_process_out|close_subwindow|" +
|
||||||
|
"close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" +
|
||||||
|
"combine|combine|command|compact|compare|compare_big_int|compare_num|" +
|
||||||
|
"complex32|complex64|concat|conj|connect|contains|contains_from|contents|" +
|
||||||
|
"copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" +
|
||||||
|
"create_matrix|create_matrix|create_matrix|create_object|" +
|
||||||
|
"create_object_and_run_initializers|create_object_opt|create_process|" +
|
||||||
|
"create_process|create_process_env|create_process_env|create_table|" +
|
||||||
|
"current|current_dir_name|current_point|current_x|current_y|curveto|" +
|
||||||
|
"custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" +
|
||||||
|
"delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" +
|
||||||
|
"dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" +
|
||||||
|
"double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" +
|
||||||
|
"draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" +
|
||||||
|
"dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" +
|
||||||
|
"environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" +
|
||||||
|
"error_message|escaped|establish_server|executable_name|execv|execve|execvp|" +
|
||||||
|
"execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" +
|
||||||
|
"file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" +
|
||||||
|
"filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" +
|
||||||
|
"float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" +
|
||||||
|
"float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" +
|
||||||
|
"flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" +
|
||||||
|
"for_all|for_all2|force|force_newline|force_val|foreground|fork|" +
|
||||||
|
"format_of_string|formatter_of_buffer|formatter_of_out_channel|" +
|
||||||
|
"fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" +
|
||||||
|
"from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" +
|
||||||
|
"full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" +
|
||||||
|
"genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" +
|
||||||
|
"get_all_formatter_output_functions|get_approx_printing|get_copy|" +
|
||||||
|
"get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" +
|
||||||
|
"get_formatter_output_functions|get_formatter_tag_functions|get_image|" +
|
||||||
|
"get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" +
|
||||||
|
"get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" +
|
||||||
|
"get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" +
|
||||||
|
"getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" +
|
||||||
|
"getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" +
|
||||||
|
"getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" +
|
||||||
|
"getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" +
|
||||||
|
"getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" +
|
||||||
|
"global_replace|global_substitute|gmtime|green|grid|group_beginning|" +
|
||||||
|
"group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" +
|
||||||
|
"hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" +
|
||||||
|
"incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" +
|
||||||
|
"infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" +
|
||||||
|
"input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" +
|
||||||
|
"int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" +
|
||||||
|
"int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" +
|
||||||
|
"is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" +
|
||||||
|
"is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" +
|
||||||
|
"kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" +
|
||||||
|
"lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" +
|
||||||
|
"lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" +
|
||||||
|
"loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" +
|
||||||
|
"logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" +
|
||||||
|
"lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" +
|
||||||
|
"make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" +
|
||||||
|
"marshal|match_beginning|match_end|matched_group|matched_string|max|" +
|
||||||
|
"max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" +
|
||||||
|
"max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" +
|
||||||
|
"min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" +
|
||||||
|
"minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" +
|
||||||
|
"mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" +
|
||||||
|
"nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" +
|
||||||
|
"new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" +
|
||||||
|
"nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" +
|
||||||
|
"num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" +
|
||||||
|
"of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" +
|
||||||
|
"of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" +
|
||||||
|
"open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" +
|
||||||
|
"open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" +
|
||||||
|
"open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" +
|
||||||
|
"open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" +
|
||||||
|
"out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" +
|
||||||
|
"output_char|output_string|output_value|over_max_boxes|pack|params|" +
|
||||||
|
"parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" +
|
||||||
|
"place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" +
|
||||||
|
"power_big_int_positive_big_int|power_big_int_positive_int|" +
|
||||||
|
"power_int_positive_big_int|power_int_positive_int|power_num|" +
|
||||||
|
"pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" +
|
||||||
|
"pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" +
|
||||||
|
"pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" +
|
||||||
|
"pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" +
|
||||||
|
"pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" +
|
||||||
|
"pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" +
|
||||||
|
"pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" +
|
||||||
|
"pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" +
|
||||||
|
"pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" +
|
||||||
|
"pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" +
|
||||||
|
"pp_set_formatter_out_channel|pp_set_formatter_output_functions|" +
|
||||||
|
"pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" +
|
||||||
|
"pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" +
|
||||||
|
"pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" +
|
||||||
|
"prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" +
|
||||||
|
"print_bool|print_break|print_char|print_cut|print_endline|print_float|" +
|
||||||
|
"print_flush|print_if_newline|print_int|print_newline|print_space|" +
|
||||||
|
"print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" +
|
||||||
|
"public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" +
|
||||||
|
"raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" +
|
||||||
|
"read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" +
|
||||||
|
"recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" +
|
||||||
|
"regexp_string_case_fold|register|register_exception|rem|remember_mode|" +
|
||||||
|
"remove|remove_assoc|remove_assq|rename|replace|replace_first|" +
|
||||||
|
"replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" +
|
||||||
|
"rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" +
|
||||||
|
"rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" +
|
||||||
|
"run_initializers|run_initializers_opt|scanf|search_backward|" +
|
||||||
|
"search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" +
|
||||||
|
"set_all_formatter_output_functions|set_approx_printing|" +
|
||||||
|
"set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" +
|
||||||
|
"set_close_on_exec|set_color|set_ellipsis_text|" +
|
||||||
|
"set_error_when_null_denominator|set_field|set_floating_precision|" +
|
||||||
|
"set_font|set_formatter_out_channel|set_formatter_output_functions|" +
|
||||||
|
"set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" +
|
||||||
|
"set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" +
|
||||||
|
"set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" +
|
||||||
|
"set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" +
|
||||||
|
"set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" +
|
||||||
|
"setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" +
|
||||||
|
"setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" +
|
||||||
|
"shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" +
|
||||||
|
"shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" +
|
||||||
|
"shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" +
|
||||||
|
"sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" +
|
||||||
|
"sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" +
|
||||||
|
"sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" +
|
||||||
|
"sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" +
|
||||||
|
"sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" +
|
||||||
|
"slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" +
|
||||||
|
"slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" +
|
||||||
|
"split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" +
|
||||||
|
"square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" +
|
||||||
|
"stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" +
|
||||||
|
"stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" +
|
||||||
|
"str_formatter|string|string_after|string_before|string_match|" +
|
||||||
|
"string_of_big_int|string_of_bool|string_of_float|string_of_format|" +
|
||||||
|
"string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" +
|
||||||
|
"string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" +
|
||||||
|
"sub_right|subset|subset|substitute_first|substring|succ|succ|" +
|
||||||
|
"succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" +
|
||||||
|
"symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" +
|
||||||
|
"tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" +
|
||||||
|
"tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" +
|
||||||
|
"temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" +
|
||||||
|
"tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" +
|
||||||
|
"to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" +
|
||||||
|
"to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" +
|
||||||
|
"truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" +
|
||||||
|
"uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" +
|
||||||
|
"unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" +
|
||||||
|
"update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" +
|
||||||
|
"wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
|
||||||
|
"wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
|
||||||
|
"widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
|
||||||
|
|
||||||
|
"Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
|
||||||
|
"Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
|
||||||
|
"Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
|
||||||
|
"Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
|
||||||
|
"MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
|
||||||
|
"Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
|
||||||
|
"Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"variable.language": "this",
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": builtinConstants,
|
||||||
|
"support.function": builtinFunctions
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
|
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||||
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||||
|
var binInteger = "(?:0[bB][01]+)";
|
||||||
|
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||||
|
|
||||||
|
var exponent = "(?:[eE][+-]?\\d+)";
|
||||||
|
var fraction = "(?:\\.\\d+)";
|
||||||
|
var intPart = "(?:\\d+)";
|
||||||
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
|
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||||
|
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : '\\(\\*.*?\\*\\)\\s*?$'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : '\\(\\*.*',
|
||||||
|
next : "comment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string", // single char
|
||||||
|
regex : "'.'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "string", // " string
|
||||||
|
regex : '"',
|
||||||
|
next : "qstring"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // imaginary
|
||||||
|
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : floatNumber
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "constant.numeric", // integer
|
||||||
|
regex : integer + "\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\)",
|
||||||
|
next : "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(OcamlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.OcamlHighlightRules = OcamlHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
232
src/main/webapp/assets/ace/mode-pascal.js
Normal file
232
src/main/webapp/assets/ace/mode-pascal.js
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/pascal', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/pascal_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
|
||||||
|
var FoldMode = require("./folding/coffee").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = PascalHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = ["--", "//"];
|
||||||
|
this.blockComment = [
|
||||||
|
{start: "(*", end: "*)"},
|
||||||
|
{start: "{", end: "}"}
|
||||||
|
];
|
||||||
|
|
||||||
|
this.$id = "ace/mode/pascal";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/pascal_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var PascalHighlightRules = function() {
|
||||||
|
|
||||||
|
this.$rules = { start:
|
||||||
|
[ { caseInsensitive: true,
|
||||||
|
token: 'keyword.control.pascal',
|
||||||
|
regex: '\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b' },
|
||||||
|
{ caseInsensitive: true,
|
||||||
|
token:
|
||||||
|
[ 'variable.pascal', "text",
|
||||||
|
'storage.type.prototype.pascal',
|
||||||
|
'entity.name.function.prototype.pascal' ],
|
||||||
|
regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' },
|
||||||
|
{ caseInsensitive: true,
|
||||||
|
token:
|
||||||
|
[ 'variable.pascal', "text",
|
||||||
|
'storage.type.function.pascal',
|
||||||
|
'entity.name.function.pascal' ],
|
||||||
|
regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' },
|
||||||
|
{ token: 'constant.numeric.pascal',
|
||||||
|
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|ll|LL|ull|ULL)?\\b' },
|
||||||
|
{ token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '--.*$',
|
||||||
|
push_:
|
||||||
|
[ { token: 'comment.line.double-dash.pascal.one',
|
||||||
|
regex: '$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.line.double-dash.pascal.one' } ] },
|
||||||
|
{ token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '//.*$',
|
||||||
|
push_:
|
||||||
|
[ { token: 'comment.line.double-slash.pascal.two',
|
||||||
|
regex: '$',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.line.double-slash.pascal.two' } ] },
|
||||||
|
{ token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '\\(\\*',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '\\*\\)',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block.pascal.one' } ] },
|
||||||
|
{ token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '\\{',
|
||||||
|
push:
|
||||||
|
[ { token: 'punctuation.definition.comment.pascal',
|
||||||
|
regex: '\\}',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'comment.block.pascal.two' } ] },
|
||||||
|
{ token: 'punctuation.definition.string.begin.pascal',
|
||||||
|
regex: '"',
|
||||||
|
push:
|
||||||
|
[ { token: 'constant.character.escape.pascal', regex: '\\\\.' },
|
||||||
|
{ token: 'punctuation.definition.string.end.pascal',
|
||||||
|
regex: '"',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'string.quoted.double.pascal' } ],
|
||||||
|
},
|
||||||
|
{ token: 'punctuation.definition.string.begin.pascal',
|
||||||
|
regex: '\'',
|
||||||
|
push:
|
||||||
|
[ { token: 'constant.character.escape.apostrophe.pascal',
|
||||||
|
regex: '\'\'' },
|
||||||
|
{ token: 'punctuation.definition.string.end.pascal',
|
||||||
|
regex: '\'',
|
||||||
|
next: 'pop' },
|
||||||
|
{ defaultToken: 'string.quoted.single.pascal' } ] },
|
||||||
|
{ token: 'keyword.operator',
|
||||||
|
regex: '[+\\-;,/*%]|:=|=' } ] }
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(PascalHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.PascalHighlightRules = PascalHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
358
src/main/webapp/assets/ace/mode-perl.js
Normal file
358
src/main/webapp/assets/ace/mode-perl.js
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/perl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/perl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = PerlHighlightRules;
|
||||||
|
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
this.blockComment = [
|
||||||
|
{start: "=begin", end: "=cut"},
|
||||||
|
{start: "=item", end: "=cut"}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[\:]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/perl";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/perl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var PerlHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
|
||||||
|
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = ("ARGV|ENV|INC|SIG");
|
||||||
|
|
||||||
|
var builtinFunctions = (
|
||||||
|
"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
|
||||||
|
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
|
||||||
|
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
|
||||||
|
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
|
||||||
|
"getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
|
||||||
|
"localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
|
||||||
|
"closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
|
||||||
|
"shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
|
||||||
|
"dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
|
||||||
|
"setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
|
||||||
|
"lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
|
||||||
|
"waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
|
||||||
|
"chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
|
||||||
|
"unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
|
||||||
|
"length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
|
||||||
|
"undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
|
||||||
|
"sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
|
||||||
|
"BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
|
||||||
|
"join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
|
||||||
|
"keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
|
||||||
|
"eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
|
||||||
|
"map|die|uc|lc|do"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants,
|
||||||
|
"support.function": builtinFunctions
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment.doc",
|
||||||
|
regex : "^=(?:begin|item)\\b",
|
||||||
|
next : "block_comment"
|
||||||
|
}, {
|
||||||
|
token : "string.regexp",
|
||||||
|
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : '["].*\\\\$',
|
||||||
|
next : "qqstring"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "string", // multi line string start
|
||||||
|
regex : "['].*\\\\$",
|
||||||
|
next : "qstring"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : "0x[0-9a-fA-F]+\\b"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "%#|\\$#|\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*$"
|
||||||
|
}, {
|
||||||
|
token : "lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qqstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"qstring" : [
|
||||||
|
{
|
||||||
|
token : "string",
|
||||||
|
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '.+'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"block_comment": [
|
||||||
|
{
|
||||||
|
token: "comment.doc",
|
||||||
|
regex: "^=cut\\b",
|
||||||
|
next: "start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultToken: "comment.doc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(PerlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.PerlHighlightRules = PerlHighlightRules;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
return line.match(/^\s*/)[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||||
|
if (commentRegex) {
|
||||||
|
this.foldingStartMarker = new RegExp(
|
||||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||||
|
);
|
||||||
|
this.foldingStopMarker = new RegExp(
|
||||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||||
|
|
||||||
|
if (range && !range.isMultiLine()) {
|
||||||
|
if (forceMultiline) {
|
||||||
|
range = this.getSectionRange(session, row);
|
||||||
|
} else if (foldStyle != "all")
|
||||||
|
range = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle === "markbegin")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
return session.getCommentFoldRange(row, i, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getSectionRange = function(session, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startIndent = line.search(/\S/);
|
||||||
|
var startRow = row;
|
||||||
|
var startColumn = line.length;
|
||||||
|
row = row + 1;
|
||||||
|
var endRow = row;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
if (indent === -1)
|
||||||
|
continue;
|
||||||
|
if (startIndent > indent)
|
||||||
|
break;
|
||||||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||||
|
|
||||||
|
if (subRange) {
|
||||||
|
if (subRange.start.row <= startRow) {
|
||||||
|
break;
|
||||||
|
} else if (subRange.isMultiLine()) {
|
||||||
|
row = subRange.end.row;
|
||||||
|
} else if (startIndent == indent) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1355
src/main/webapp/assets/ace/mode-pgsql.js
Normal file
1355
src/main/webapp/assets/ace/mode-pgsql.js
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user