Add AL (Microsoft Dynamics 365 Business Central) - #739
Open
SShadowS wants to merge 1 commit into
Open
Conversation
AL is the language of Microsoft Dynamics 365 Business Central. It is recognised by GitHub Linguist and has editor support in VS Code, Zed, Sublime Text and Helix. Line comments are //, block comments /* */, and string literals are single quoted, with an embedded quote written ''. The example file covers all three, including strings containing /* and // so that they are counted as code rather than opening a comment, and a branch so the complexity checks are exercised. processor/constants.go and LANGUAGES.md are regenerated with go generate. The .al extension is shared with Perl's AutoLoader, but nothing in languages.json currently claims it, so this adds no ambiguity. I explicitly licence this contribution under the MIT licence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds AL, the language of Microsoft Dynamics 365 Business Central.
I explicitly licence this contribution under the MIT licence.
The language
AL is what Business Central extensions are written in. It is a recognised language in GitHub Linguist (since 2020), and has editor support in VS Code (Microsoft's own extension), Zed, Sublime Text and Helix.
The definition
AL uses
//line comments,/* */block comments, and single quoted string literals with an embedded quote written''. The complexity keywords are AL's branching and looping constructs, in both cases. AL is case insensitive, and code converted from the older C/AL is written in upper case, so both forms are carried the way Pascal does it.processor/constants.goandLANGUAGES.mdare regenerated withgo generate ./....On the extension
.alis shared with Perl's AutoLoader, which is worth flagging because it does cause misclassification in other tools. It is not an issue here: nothing inlanguages.jsoncurrently claimsal, so this is a clean addition rather than a reassignment, and no existing count changes.Example file and tests
examples/language/al.alcovers a standalone line comment, a trailing line comment, a multi-line block comment, two branches so the complexity checks are exercised, and three strings that would break a naive counter:scc counts it as 35 lines, 4 blank, 4 comment, 27 code, complexity 2, which matches a hand count. The two complexity hits are a lower case
whileand an upper caseIF, so both keyword cases are exercised. All three strings are counted as code, so neither comment syntax leaks out of a quoted string."AL"is registered inmain_test.go, andTestSpecificLanguagespasses.The suite reports 9 failures on this machine, all of them present on a clean checkout of
masteras well (they are Windows path and line ending issues in the golden report and coupling tests, unrelated to this change).SCC-OUTPUT-REPORT.htmlis not regenerated, sincego generatedoes not produce it; happy to refresh it if you would like.AI disclosure
This change was prepared with AI assistance (Claude). The counts above were verified by hand and by running scc locally.