github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.11k stars 4.19k forks source link

Add B4X #6944

Closed DecimalTurn closed 1 week ago

DecimalTurn commented 1 month ago

Language name

B4X

URL of example repository

https://github.com/AnywhereSoftware/B4X-Pleroma

URL of syntax highlighting grammar

NA

Most popular extensions

Detected language

Usually Visual Basic 6.0 or BASIC

DecimalTurn commented 1 month ago

@AnywhereSoftware, can you confirm that there is no TextMate compatible syntax highlighting grammar (docs) for B4X? I couldn't find any, but maybe you have one available somewhere.

AnywhereSoftware commented 1 month ago

Hi,

Iā€™m not familiar with such resource.

There is a prism based grammar: https://www.b4x.com/android/forum/threads/%F0%9F%90%A2-%F0%9F%91%A9%E2%80%8D%F0%9F%8F%AB-%F0%9F%91%A8%E2%80%8D%F0%9F%8F%AB-highlighting-b4x-code-in-html-pages-using-prism.117448/#content

Best regards,

Erel Uziel

Anywhere Software

From: Martin Leduc @.> Sent: Thursday, 18 July 2024 21:10 To: github-linguist/linguist @.> Cc: AnywhereSoftware @.>; Mention @.> Subject: Re: [github-linguist/linguist] Add B4X (Issue #6944)

@AnywhereSoftware https://github.com/AnywhereSoftware , can you confirm that there is no TextMate compatible syntax highlighting grammar for B4X? I couldn't find any, but maybe you have one available somewhere.

ā€” Reply to this email directly, view it on GitHub https://github.com/github-linguist/linguist/issues/6944#issuecomment-2237197206 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGABUN64FZEXABINNTILSJ3ZNAAJLAVCNFSM6AAAAABLDFOGS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZXGE4TOMRQGY . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AGABUNYNDWSS6PEOGIH2TC3ZNAAJLA5CNFSM6AAAAABLDFOGS2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUFLDVZM.gif Message ID: @. @.> >

DecimalTurn commented 1 month ago

Thanks @AnywhereSoftware, a prism grammar is a good starting point, but it would need to be converted to the TextMate format and hosted on GitHub to be used as a grammar for syntax highlighting on GitHub.

Another possibility, in the meantime, would be to use VBA or VB.NET's grammar which are similar and already available. If you'd be OK with using one of these, let me know which one you prefer and I can go forward with a PR to add B4X.

Here's a demo of how it would look like (you'll need to view this on GitHub directly and not just on you email client I'm assuming).

Using this file.

Using VBA's syntax highlighting:


B4A=true
Group=MAIN
ModulesStructureVersion=1
Type=Service
Version=11.8
@EndOfDesignText@
#Region  Service Attributes 
    #StartAtBoot: True  
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    '---
    Private AutoStartBeenChecked As Boolean = False
    Private xui As XUI
End Sub

Sub Service_Create
End Sub

Sub Service_Start (StartingIntent As Intent)
    Log("Service_Start - startAtBoot")
    If AutoStartBeenChecked = False Then
        AutoStartBeenChecked = True
        If ( File.Exists(xui.DefaultFolder,"autostart.bin") ) Then
            StartApp
        End If
    End If
    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
    StopService(Me) '--- above line replaces this
End Sub

Sub Service_Destroy
End Sub

Private Sub StartApp()
    Dim Intent1 As Intent
    Dim pm As PackageManager
    #if klipper
    Intent1 = pm.GetApplicationIntent("sadLogic.KlipperTouchController")
    #else
    Intent1 = pm.GetApplicationIntent("sadLogic.OctoTouchController")
    #End If
    StartActivity(Intent1)
End Sub

Using VB.NET's syntax highlighthing:


B4A=true
Group=MAIN
ModulesStructureVersion=1
Type=Service
Version=11.8
@EndOfDesignText@
#Region  Service Attributes 
    #StartAtBoot: True  
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    '---
    Private AutoStartBeenChecked As Boolean = False
    Private xui As XUI
End Sub

Sub Service_Create
End Sub

Sub Service_Start (StartingIntent As Intent)
    Log("Service_Start - startAtBoot")
    If AutoStartBeenChecked = False Then
        AutoStartBeenChecked = True
        If ( File.Exists(xui.DefaultFolder,"autostart.bin") ) Then
            StartApp
        End If
    End If
    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
    StopService(Me) '--- above line replaces this
End Sub

Sub Service_Destroy
End Sub

Private Sub StartApp()
    Dim Intent1 As Intent
    Dim pm As PackageManager
    #if klipper
    Intent1 = pm.GetApplicationIntent("sadLogic.KlipperTouchController")
    #else
    Intent1 = pm.GetApplicationIntent("sadLogic.OctoTouchController")
    #End If
    StartActivity(Intent1)
End Sub
AnywhereSoftware commented 1 month ago

Hi,

The VBA grammar looks fine. Thank you for pushing this.

Best regards,

Erel Uziel

Anywhere Software

From: Martin Leduc @.> Sent: Monday, 22 July 2024 1:02 To: github-linguist/linguist @.> Cc: AnywhereSoftware @.>; Mention @.> Subject: Re: [github-linguist/linguist] Add B4X (Issue #6944)

Thanks @AnywhereSoftware https://github.com/AnywhereSoftware , a prism grammar is a good starting point, but it would need to be converted to the TextMate format and hosted on GitHub to be used as a grammar for syntax highlighting on GitHub.

Another possibility, in the meantime, would be to use VBA or VB.NET's grammar which are similar and already available. If you'd be OK with using one of these, let me know which one you prefer and I can go forward with a PR to add B4X.

Here's a demo of how it would look like (you'll need to view this on GitHub directly and not just on you email client I'm assuming).

Using this file https://github.com/jakebullet70/OctoTouchController/blob/fcf32317a311cb3abb0dcfad4dd34e5ec23edf1b/src/main/startAtBoot.bas .

Using VBA's syntax highlighting:

B4A=true Group=MAIN ModulesStructureVersion=1 Type=Service Version=11.8 @EndOfDesignText@

Region Service Attributes

    #StartAtBoot: True     

End Region

Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. '--- Private AutoStartBeenChecked As Boolean = False Private xui As XUI End Sub

Sub Service_Create End Sub

Sub Service_Start (StartingIntent As Intent) Log("Service_Start - startAtBoot") If AutoStartBeenChecked = False Then AutoStartBeenChecked = True If ( File.Exists(xui.DefaultFolder,"autostart.bin") ) Then StartApp End If End If Service.StopAutomaticForeground 'Call this when the background task completes (if there is one) StopService(Me) '--- above line replaces this End Sub

Sub Service_Destroy End Sub

Private Sub StartApp() Dim Intent1 As Intent Dim pm As PackageManager

if klipper

    Intent1 = pm.GetApplicationIntent("sadLogic.KlipperTouchController")
    #else
    Intent1 = pm.GetApplicationIntent("sadLogic.OctoTouchController")
    #End If
    StartActivity(Intent1)

End Sub

Using VB.NET's syntax highlighthing:

B4A=true Group=MAIN ModulesStructureVersion=1 Type=Service Version=11.8 @EndOfDesignText@

Region Service Attributes

    #StartAtBoot: True     

End Region

Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. '--- Private AutoStartBeenChecked As Boolean = False Private xui As XUI End Sub

Sub Service_Create End Sub

Sub Service_Start (StartingIntent As Intent) Log("Service_Start - startAtBoot") If AutoStartBeenChecked = False Then AutoStartBeenChecked = True If ( File.Exists(xui.DefaultFolder,"autostart.bin") ) Then StartApp End If End If Service.StopAutomaticForeground 'Call this when the background task completes (if there is one) StopService(Me) '--- above line replaces this End Sub

Sub Service_Destroy End Sub

Private Sub StartApp() Dim Intent1 As Intent Dim pm As PackageManager

if klipper

    Intent1 = pm.GetApplicationIntent("sadLogic.KlipperTouchController")
    #else
    Intent1 = pm.GetApplicationIntent("sadLogic.OctoTouchController")
    #End If
    StartActivity(Intent1)

End Sub

ā€” Reply to this email directly, view it on GitHub https://github.com/github-linguist/linguist/issues/6944#issuecomment-2241787324 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGABUN5HAZHBEN57YOWZ3VTZNQVULAVCNFSM6AAAAABLDFOGS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRG44DOMZSGQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AGABUN644VDGVJUG55XXLMTZNQVULA5CNFSM6AAAAABLDFOGS2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUFT323Y.gif Message ID: @. @.> >