[d24f17c] | 1 | /*
|
---|
| 2 | Language: LiveCode
|
---|
| 3 | Author: Ralf Bitter <rabit@revigniter.com>
|
---|
| 4 | Description: Language definition for LiveCode server accounting for revIgniter (a web application framework) characteristics.
|
---|
| 5 | Version: 1.1
|
---|
| 6 | Date: 2019-04-17
|
---|
| 7 | Category: enterprise
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | function livecodeserver(hljs) {
|
---|
| 11 | const VARIABLE = {
|
---|
| 12 | className: 'variable',
|
---|
| 13 | variants: [
|
---|
| 14 | {
|
---|
| 15 | begin: '\\b([gtps][A-Z]{1}[a-zA-Z0-9]*)(\\[.+\\])?(?:\\s*?)'
|
---|
| 16 | },
|
---|
| 17 | {
|
---|
| 18 | begin: '\\$_[A-Z]+'
|
---|
| 19 | }
|
---|
| 20 | ],
|
---|
| 21 | relevance: 0
|
---|
| 22 | };
|
---|
| 23 | const COMMENT_MODES = [
|
---|
| 24 | hljs.C_BLOCK_COMMENT_MODE,
|
---|
| 25 | hljs.HASH_COMMENT_MODE,
|
---|
| 26 | hljs.COMMENT('--', '$'),
|
---|
| 27 | hljs.COMMENT('[^:]//', '$')
|
---|
| 28 | ];
|
---|
| 29 | const TITLE1 = hljs.inherit(hljs.TITLE_MODE, {
|
---|
| 30 | variants: [
|
---|
| 31 | {
|
---|
| 32 | begin: '\\b_*rig[A-Z][A-Za-z0-9_\\-]*'
|
---|
| 33 | },
|
---|
| 34 | {
|
---|
| 35 | begin: '\\b_[a-z0-9\\-]+'
|
---|
| 36 | }
|
---|
| 37 | ]
|
---|
| 38 | });
|
---|
| 39 | const TITLE2 = hljs.inherit(hljs.TITLE_MODE, {
|
---|
| 40 | begin: '\\b([A-Za-z0-9_\\-]+)\\b'
|
---|
| 41 | });
|
---|
| 42 | return {
|
---|
| 43 | name: 'LiveCode',
|
---|
| 44 | case_insensitive: false,
|
---|
| 45 | keywords: {
|
---|
| 46 | keyword:
|
---|
| 47 | '$_COOKIE $_FILES $_GET $_GET_BINARY $_GET_RAW $_POST $_POST_BINARY $_POST_RAW $_SESSION $_SERVER ' +
|
---|
| 48 | 'codepoint codepoints segment segments codeunit codeunits sentence sentences trueWord trueWords paragraph ' +
|
---|
| 49 | 'after byte bytes english the until http forever descending using line real8 with seventh ' +
|
---|
| 50 | 'for stdout finally element word words fourth before black ninth sixth characters chars stderr ' +
|
---|
| 51 | 'uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid ' +
|
---|
| 52 | 'at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 ' +
|
---|
| 53 | 'int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat ' +
|
---|
| 54 | 'end repeat URL in try into switch to words https token binfile each tenth as ticks tick ' +
|
---|
| 55 | 'system real4 by dateItems without char character ascending eighth whole dateTime numeric short ' +
|
---|
| 56 | 'first ftp integer abbreviated abbr abbrev private case while if ' +
|
---|
| 57 | 'div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within ' +
|
---|
| 58 | 'contains ends with begins the keys of keys',
|
---|
| 59 | literal:
|
---|
| 60 | 'SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE ' +
|
---|
| 61 | 'QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO ' +
|
---|
| 62 | 'six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five ' +
|
---|
| 63 | 'quote empty one true return cr linefeed right backslash null seven tab three two ' +
|
---|
| 64 | 'RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK ' +
|
---|
| 65 | 'FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK',
|
---|
| 66 | built_in:
|
---|
| 67 | 'put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg avgDev base64Decode ' +
|
---|
| 68 | 'base64Encode baseConvert binaryDecode binaryEncode byteOffset byteToNum cachedURL cachedURLs charToNum ' +
|
---|
| 69 | 'cipherNames codepointOffset codepointProperty codepointToNum codeunitOffset commandNames compound compress ' +
|
---|
| 70 | 'constantNames cos date dateFormat decompress difference directories ' +
|
---|
| 71 | 'diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames geometricMean global ' +
|
---|
| 72 | 'globals hasMemory harmonicMean hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset ' +
|
---|
| 73 | 'keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders ' +
|
---|
| 74 | 'libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 ' +
|
---|
| 75 | 'longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge messageAuthenticationCode messageDigest millisec ' +
|
---|
| 76 | 'millisecs millisecond milliseconds min monthNames nativeCharToNum normalizeText num number numToByte numToChar ' +
|
---|
| 77 | 'numToCodepoint numToNativeChar offset open openfiles openProcesses openProcessIDs openSockets ' +
|
---|
| 78 | 'paragraphOffset paramCount param params peerAddress pendingMessages platform popStdDev populationStandardDeviation ' +
|
---|
| 79 | 'populationVariance popVariance processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile ' +
|
---|
| 80 | 'revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull ' +
|
---|
| 81 | 'revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered ' +
|
---|
| 82 | 'revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames ' +
|
---|
| 83 | 'revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull ' +
|
---|
| 84 | 'revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections ' +
|
---|
| 85 | 'revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype ' +
|
---|
| 86 | 'revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext ' +
|
---|
| 87 | 'revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames ' +
|
---|
| 88 | 'revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase ' +
|
---|
| 89 | 'revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute ' +
|
---|
| 90 | 'revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLCreateTreeFromFileWithNamespaces ' +
|
---|
| 91 | 'revXMLCreateTreeWithNamespaces revXMLDataFromXPathQuery revXMLEvaluateXPath revXMLFirstChild revXMLMatchingNode ' +
|
---|
| 92 | 'revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling ' +
|
---|
| 93 | 'revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error ' +
|
---|
| 94 | 'revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_Execute ' +
|
---|
| 95 | 'revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort ' +
|
---|
| 96 | 'revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree ' +
|
---|
| 97 | 'revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sampVariance ' +
|
---|
| 98 | 'sec secs seconds sentenceOffset sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound ' +
|
---|
| 99 | 'stdDev sum sysError systemVersion tan tempName textDecode textEncode tick ticks time to tokenOffset toLower toUpper ' +
|
---|
| 100 | 'transpose truewordOffset trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus uuid value variableNames ' +
|
---|
| 101 | 'variance version waitDepth weekdayNames wordOffset xsltApplyStylesheet xsltApplyStylesheetFromFile xsltLoadStylesheet ' +
|
---|
| 102 | 'xsltLoadStylesheetFromFile add breakpoint cancel clear local variable file word line folder directory URL close socket process ' +
|
---|
| 103 | 'combine constant convert create new alias folder directory decrypt delete variable word line folder ' +
|
---|
| 104 | 'directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile ' +
|
---|
| 105 | 'libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetDriver ' +
|
---|
| 106 | 'libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime ' +
|
---|
| 107 | 'libURLSetStatusCallback load extension loadedExtensions multiply socket prepare process post seek rel relative read from process rename ' +
|
---|
| 108 | 'replace require resetAll resolve revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase ' +
|
---|
| 109 | 'revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees ' +
|
---|
| 110 | 'revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord ' +
|
---|
| 111 | 'revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase ' +
|
---|
| 112 | 'revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD ' +
|
---|
| 113 | 'revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost ' +
|
---|
| 114 | 'revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData ' +
|
---|
| 115 | 'revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel ' +
|
---|
| 116 | 'revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback ' +
|
---|
| 117 | 'revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split start stop ' +
|
---|
| 118 | 'subtract symmetric union unload vectorDotProduct wait write'
|
---|
| 119 | },
|
---|
| 120 | contains: [
|
---|
| 121 | VARIABLE,
|
---|
| 122 | {
|
---|
| 123 | className: 'keyword',
|
---|
| 124 | begin: '\\bend\\sif\\b'
|
---|
| 125 | },
|
---|
| 126 | {
|
---|
| 127 | className: 'function',
|
---|
| 128 | beginKeywords: 'function',
|
---|
| 129 | end: '$',
|
---|
| 130 | contains: [
|
---|
| 131 | VARIABLE,
|
---|
| 132 | TITLE2,
|
---|
| 133 | hljs.APOS_STRING_MODE,
|
---|
| 134 | hljs.QUOTE_STRING_MODE,
|
---|
| 135 | hljs.BINARY_NUMBER_MODE,
|
---|
| 136 | hljs.C_NUMBER_MODE,
|
---|
| 137 | TITLE1
|
---|
| 138 | ]
|
---|
| 139 | },
|
---|
| 140 | {
|
---|
| 141 | className: 'function',
|
---|
| 142 | begin: '\\bend\\s+',
|
---|
| 143 | end: '$',
|
---|
| 144 | keywords: 'end',
|
---|
| 145 | contains: [
|
---|
| 146 | TITLE2,
|
---|
| 147 | TITLE1
|
---|
| 148 | ],
|
---|
| 149 | relevance: 0
|
---|
| 150 | },
|
---|
| 151 | {
|
---|
| 152 | beginKeywords: 'command on',
|
---|
| 153 | end: '$',
|
---|
| 154 | contains: [
|
---|
| 155 | VARIABLE,
|
---|
| 156 | TITLE2,
|
---|
| 157 | hljs.APOS_STRING_MODE,
|
---|
| 158 | hljs.QUOTE_STRING_MODE,
|
---|
| 159 | hljs.BINARY_NUMBER_MODE,
|
---|
| 160 | hljs.C_NUMBER_MODE,
|
---|
| 161 | TITLE1
|
---|
| 162 | ]
|
---|
| 163 | },
|
---|
| 164 | {
|
---|
| 165 | className: 'meta',
|
---|
| 166 | variants: [
|
---|
| 167 | {
|
---|
| 168 | begin: '<\\?(rev|lc|livecode)',
|
---|
| 169 | relevance: 10
|
---|
| 170 | },
|
---|
| 171 | {
|
---|
| 172 | begin: '<\\?'
|
---|
| 173 | },
|
---|
| 174 | {
|
---|
| 175 | begin: '\\?>'
|
---|
| 176 | }
|
---|
| 177 | ]
|
---|
| 178 | },
|
---|
| 179 | hljs.APOS_STRING_MODE,
|
---|
| 180 | hljs.QUOTE_STRING_MODE,
|
---|
| 181 | hljs.BINARY_NUMBER_MODE,
|
---|
| 182 | hljs.C_NUMBER_MODE,
|
---|
| 183 | TITLE1
|
---|
| 184 | ].concat(COMMENT_MODES),
|
---|
| 185 | illegal: ';$|^\\[|^=|&|\\{'
|
---|
| 186 | };
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | module.exports = livecodeserver;
|
---|