Skip to content

Xojo Definition #4295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SUPPORTED_LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
71 changes: 71 additions & 0 deletions src/languages/xojo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
Language: Xojo
Description: Xojo is a statically typed, cross-platform object-oriented programming language.
Author: Dr Garry Pettet <[email protected]>
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'
}
]
};
}
4 changes: 4 additions & 0 deletions test/detect/xojo/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dim name As String = "Xojo"
If name <> "" Then
System.DebugLog(name)
End If
8 changes: 8 additions & 0 deletions test/markup/xojo/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<pre>
```xojo
Dim name As String = "Xojo"
If name <> "" Then
System.DebugLog(name)
End If
```
</pre>