l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

livecodeserver.js (10264B)


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