diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index c0a9ae6e58..d5a4b9b12e 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -266,6 +266,7 @@ The table below shows the full list of languages (and corresponding classes/alia | x86 Assembly | x86asm | | | x86 Assembly (AT&T) | x86asmatt | [highlightjs-x86asmatt](https://github.com/gondow/highlightjs-x86asmatt) | | XL | xl, tao | | +| Xojo | xojo | [highlight.js-xojo](https://github.com/patricksalo/highlight.js-xojo) | | XQuery | xquery, xpath, xq, xqm | | | YAML | yml, yaml | | | ZenScript | zenscript, zs |[highlightjs-zenscript](https://github.com/highlightjs/highlightjs-zenscript) | diff --git a/src/languages/xojo.js b/src/languages/xojo.js new file mode 100644 index 0000000000..1a497c0669 --- /dev/null +++ b/src/languages/xojo.js @@ -0,0 +1,71 @@ +/* +Language: Xojo +Description: Xojo is a statically typed, cross-platform object-oriented programming language. +Author: Dr Garry Pettet +Website: https://xojo.com +*/ + +export default function(hljs) { + return { + aliases: ['xojo'], + case_insensitive: true, + keywords: { + keyword: + 'AddHandler AddressOf Aggregates And Array As Assigns Async Attributes Await Break ByRef ByVal ' + + 'Call Case Catch Class Const Continue CType Declare Dim Do DownTo ' + + 'Each Else ElseIf End Enum Event Exception Exit Extends Finally For Function ' + + 'Global GoTo Handles If Implements In Inherits Interface Is IsA ' + + 'Lib Loop Me Mod Module ' + + 'Namespace New Next Nil Not ' + + 'Of Optional Or ' + + 'ParamArray Private Property Protected Public ' + + 'Raise RaiseEvent Redim RemoveHandler Return ' + + 'Select Self Shared Soft Static Step Structure Sub Super ' + + 'Then To Try Until Using Var WeakAddressOf Wend While With Xor', + data_type: + 'Auto Boolean CFStringRef CGFloat Color CString Currency ' + + 'Delegate Double Enumeration Int8 Int16 Int32 Int64 Integer Object ' + + 'OSType PString Prt Short Single String Structure Text ' + + 'UInt8 UInt16 UInt32 UInt64 UInteger Variant WindowPtr WString', + literal: + 'True False Nil' + }, + contains: [ + hljs.QUOTE_STRING_MODE, + hljs.COMMENT('REM\\b', '$'), + hljs.COMMENT('\'', '$'), + hljs.COMMENT('\/\/', '$'), + { + className: 'double', + variants: [ + { begin: '\\b\\d+\\.\\d+[eE]-?\\d+' }, + { begin: '\\b\\d+\\.\\d+' } + ] + }, + { + className: 'integer', + variants: [ + { begin: '\\b\\d+[eE]-?\\d+' }, + { begin: '\\b\\d+' }, + { begin: '\\&h[a-fA-F0-9]+' }, + { begin: '\\&o[0-7]+' }, + { begin: '\\&b[0-1]+' } + ] + }, + { + className: 'color', + begin: '\\&c', + contains: [ + { + className: 'rgb_component', + begin: '[a-fA-F0-9]{2}' + } + ] + }, + { + className: 'meta', + begin: '#Bad|#Else|#ElseIf|#EndIf|#If|#Pragma|#Tag' + } + ] + }; +} diff --git a/test/detect/xojo/default.txt b/test/detect/xojo/default.txt new file mode 100644 index 0000000000..ec924b754a --- /dev/null +++ b/test/detect/xojo/default.txt @@ -0,0 +1,4 @@ +Dim name As String = "Xojo" +If name <> "" Then + System.DebugLog(name) +End If \ No newline at end of file diff --git a/test/markup/xojo/default.txt b/test/markup/xojo/default.txt new file mode 100644 index 0000000000..e048343dac --- /dev/null +++ b/test/markup/xojo/default.txt @@ -0,0 +1,8 @@ +
+```xojo
+Dim name As String = "Xojo"
+If name <> "" Then
+  System.DebugLog(name)
+End If
+```
+