Repository: alecthomas/chroma
Pull request #473 (2021-04-23 18:30:15)

Add AL lexer
Hi,

This PR adds a lexer for the [AL language](https://github.com/microsoft/AL) of Microsoft Business Central.
It is based on this [grammar file](https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage) to which I have added the new objects  ([Report extensibility](https://docs.microsoft.com/en-us/dynamics365-release-plan/2021wave1/smb/dynamics365-business-central/report-extensibility) and [New AL objects](https://docs.microsoft.com/en-us/dynamics365-release-plan/2021wave1/smb/dynamics365-business-central/new-al-objects-entitlement-permissionset-permissionsetextension)) just released in the new version of BC 2021 wave 1 and also the [preprocessor directives](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/directives/devenv-directives-in-al).

The tests I have done look good and as a test file I have used [this one](https://github.com/microsoft/AL/blob/master/highlightjs_al/test/default.txt). There are many code examples in this [repository](https://github.com/microsoft/ALAppExtensions).

If anything can be improved, I'll be happy to hear from you and try to help, but I don't know if I'll be of much help since I don't program in go and I don't use regular expressions regularly.

PS: I had to change the commit author because I had used my work account instead of my personal one.



Patch:
diff --git a/lexers/a/al.go b/lexers/a/al.go
new file mode 100644
index 0000000..d701644
--- /dev/null
+++ b/lexers/a/al.go
@@ -0,0 +1,48 @@
+package a
+
+import (
+	. "github.com/alecthomas/chroma" // nolint
+	"github.com/alecthomas/chroma/lexers/internal"
+)
+
+// Al lexer.
+var Al = internal.Register(MustNewLazyLexer(
+	&Config{
+		Name:            "AL",
+		Aliases:         []string{"al"},
+		Filenames:       []string{"*.al", "*.dal"},
+		MimeTypes:       []string{"text/x-al"},
+		DotAll:          true,
+		CaseInsensitive: true,
+	},
+	alRules,
+))
+
+// https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage
+func alRules() Rules {
+	return Rules{
+		"root": {
+			{`\s+`, TextWhitespace, nil},
+			{`(?s)\/\*.*?\\*\*\/`, CommentMultiline, nil},
+			{`(?s)//.*?\n`, CommentSingle, nil},
+			{`\"([^\"])*\"`, Text, nil},
+			{`'([^'])*'`, LiteralString, nil},
+			{`\b(?i:(ARRAY|ASSERTERROR|BEGIN|BREAK|CASE|DO|DOWNTO|ELSE|END|EVENT|EXIT|FOR|FOREACH|FUNCTION|IF|IMPLEMENTS|IN|INDATASET|INTERFACE|INTERNAL|LOCAL|OF|PROCEDURE|PROGRAM|PROTECTED|REPEAT|RUNONCLIENT|SECURITYFILTERING|SUPPRESSDISPOSE|TEMPORARY|THEN|TO|TRIGGER|UNTIL|VAR|WHILE|WITH|WITHEVENTS))\b`, Keyword, nil},
+			{`\b(?i:(AND|DIV|MOD|NOT|OR|XOR))\b`, OperatorWord, nil},
+			{`\b(?i:(AVERAGE|CONST|COUNT|EXIST|FIELD|FILTER|LOOKUP|MAX|MIN|ORDER|SORTING|SUM|TABLEDATA|UPPERLIMIT|WHERE|ASCENDING|DESCENDING))\b`, Keyword, nil},
+			// Added new objects types of BC 2021 wave 1 (REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension)
+			{`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension))\b`, Keyword, nil},
+			{`\b(?i:(Action|Array|Automation|BigInteger|BigText|Blob|Boolean|Byte|Char|ClientType|Code|Codeunit|CompletionTriggerErrorLevel|ConnectionType|Database|DataClassification|DataScope|Date|DateFormula|DateTime|Decimal|DefaultLayout|Dialog|Dictionary|DotNet|DotNetAssembly|DotNetTypeDeclaration|Duration|Enum|ErrorInfo|ErrorType|ExecutionContext|ExecutionMode|FieldClass|FieldRef|FieldType|File|FilterPageBuilder|Guid|InStream|Integer|Joker|KeyRef|List|ModuleDependencyInfo|ModuleInfo|None|Notification|NotificationScope|ObjectType|Option|OutStream|Page|PageResult|Query|Record|RecordId|RecordRef|Report|ReportFormat|SecurityFilter|SecurityFiltering|Table|TableConnectionType|TableFilter|TestAction|TestField|TestFilterField|TestPage|TestPermissions|TestRequestPage|Text|TextBuilder|TextConst|TextEncoding|Time|TransactionModel|TransactionType|Variant|Verbosity|Version|XmlPort|HttpContent|HttpHeaders|HttpClient|HttpRequestMessage|HttpResponseMessage|JsonToken|JsonValue|JsonArray|JsonObject|View|Views|XmlAttribute|XmlAttributeCollection|XmlComment|XmlCData|XmlDeclaration|XmlDocument|XmlDocumentType|XmlElement|XmlNamespaceManager|XmlNameTable|XmlNode|XmlNodeList|XmlProcessingInstruction|XmlReadOptions|XmlText|XmlWriteOptions|WebServiceActionContext|WebServiceActionResultCode|SessionSettings))\b`, Keyword, nil},
+			{`\b([<>]=|<>|<|>)\b?`, Operator, nil},
+			{`\b(\-|\+|\/|\*)\b`, Operator, nil},
+			{`\s*(\:=|\+=|-=|\/=|\*=)\s*?`, Operator, nil},
+			{`\b(?i:(ADDFIRST|ADDLAST|ADDAFTER|ADDBEFORE|ACTION|ACTIONS|AREA|ASSEMBLY|CHARTPART|CUEGROUP|CUSTOMIZES|COLUMN|DATAITEM|DATASET|ELEMENTS|EXTENDS|FIELD|FIELDGROUP|FIELDATTRIBUTE|FIELDELEMENT|FIELDGROUPS|FIELDS|FILTER|FIXED|GRID|GROUP|MOVEAFTER|MOVEBEFORE|KEY|KEYS|LABEL|LABELS|LAYOUT|MODIFY|MOVEFIRST|MOVELAST|MOVEBEFORE|MOVEAFTER|PART|REPEATER|USERCONTROL|REQUESTPAGE|SCHEMA|SEPARATOR|SYSTEMPART|TABLEELEMENT|TEXTATTRIBUTE|TEXTELEMENT|TYPE))\b`, Keyword, nil},
+			{`\s*[(\.\.)&\|]\s*`, Operator, nil},
+			{`\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b`, LiteralNumber, nil},
+			{`[;:,]`, Punctuation, nil},
+			{`#[ \t]*(if|else|elif|endif|define|undef|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil},
+			{`\w+`, Text, nil},
+			{`.`, Text, nil},
+		},
+	}
+}


Test patch:
diff --git a/lexers/testdata/al.actual b/lexers/testdata/al.actual
new file mode 100644
index 0000000..228e304
--- /dev/null
+++ b/lexers/testdata/al.actual
@@ -0,0 +1,98 @@
+/// <summary>
+/// Manage Loyalty Benefits
+/// </summary>
+codeunit 50100 "Loyalty Benefits Management"
+{
+    var
+        Vendor: record Vendor;
+
+    trigger OnRun()
+    begin
+    end;
+
+    /// <summary>
+    /// Adjust a Sales Order with loyalty level
+    /// </summary>
+    /// <param name="SalesHeader">Sales Header to adjust based on Customer Loyalty</param>
+    procedure AdjustForLoyalty(var SalesHeader: record "Sales Header"): Integer;
+    var
+        Customer: record Customer;
+        LoyaltyBenefits: interface ILoyaltyBenefits;
+        Discount: Decimal;
+    begin
+        Customer.Get(SalesHeader."Sell-to Customer No.");
+
+        LoyaltyBenefits := Customer.Loyalty;
+        Discount := 1;
+        Discount := LoyaltyBenefits.GetDiscount();
+        ApplyDiscount(SalesHeader, Discount);
+    end;
+
+    /// <summary>
+    /// Applies the Discount to the Sales Order
+    /// </summary>
+    /// <param name="SalesHeader">Sales Order</param>
+    /// <param name="Discount">Discount to apply</param>
+    local procedure "Apply Discount"(SalesHeader: record "Sales Header"; Discount: Decimal)
+    begin
+        // TODO: Implement
+    end;
+}
+
+
+enum 50140 SomeEnum
+{
+    value(0; None) { }
+}
+
+#region interface stuff
+
+interface ISuperGreat
+{
+    procedure YesSir("c in c": codeunit FooBar);
+}
+
+#endregion
+
+table 50100 Customer
+{
+    Access = Internal;
+    TableType = Normal;
+
+    fields
+    {
+        field(1; "P K"; Integer)
+        {
+        }
+    }
+}
+
+/// <summary>
+/// Add the Loyalty fields to the Customer table.
+/// </summary>
+tableextension 50100 LoyaltyCustomerExt extends Customer
+{
+    fields
+    {
+        /// <summary>
+        /// Customer loyalty.
+        /// </summary>
+        field(50100; Loyalty; enum LoyaltyLevel)
+        {
+        }
+    }
+}
+
+/// <summary>
+/// Adds the Loyalty field to the General group on the "Customer Card"
+/// </summary>
+pageextension 50100 LoyaltyCustCardExt extends "Customer Card"
+{
+    layout
+    {
+        addlast(General)
+        {
+            field(Loyalty; Rec.Loyalty) { }
+        }
+    }
+}
\ No newline at end of file
diff --git a/lexers/testdata/al.expected b/lexers/testdata/al.expected
new file mode 100644
index 0000000..c8d52d6
--- /dev/null
+++ b/lexers/testdata/al.expected
@@ -0,0 +1,342 @@
+[
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n/// Manage Loyalty Benefits\n/// \u003c/summary\u003e\n"},
+  {"type":"Keyword","value":"codeunit"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"50100"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"Loyalty Benefits Management\""},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"var"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Vendor"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"record"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Vendor"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n\n    "},
+  {"type":"Keyword","value":"trigger"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"OnRun"},
+  {"type":"Operator","value":"()\n    "},
+  {"type":"Keyword","value":"begin"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"end"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n\n    "},
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// Adjust a Sales Order with loyalty level\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// \u003c/summary\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// \u003cparam name=\"SalesHeader\"\u003eSales Header to adjust based on Customer Loyalty\u003c/param\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"Keyword","value":"procedure"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"AdjustForLoyalty"},
+  {"type":"Operator","value":"("},
+  {"type":"Keyword","value":"var"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"SalesHeader"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"record"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"Sales Header\""},
+  {"type":"Operator","value":")"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"Integer"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"var"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Customer"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"record"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Customer"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"LoyaltyBenefits"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"interface"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"ILoyaltyBenefits"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Discount"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"Decimal"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"begin"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Customer"},
+  {"type":"Operator","value":"."},
+  {"type":"Text","value":"Get"},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"SalesHeader"},
+  {"type":"Operator","value":"."},
+  {"type":"Text","value":"\"Sell-to Customer No.\""},
+  {"type":"Operator","value":")"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n\n        "},
+  {"type":"Text","value":"LoyaltyBenefits"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Operator","value":":="},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Customer"},
+  {"type":"Operator","value":"."},
+  {"type":"Text","value":"Loyalty"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Discount"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Operator","value":":="},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"1"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"Discount"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Operator","value":":="},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"LoyaltyBenefits"},
+  {"type":"Operator","value":"."},
+  {"type":"Text","value":"GetDiscount"},
+  {"type":"Operator","value":"()"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"ApplyDiscount"},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"SalesHeader"},
+  {"type":"Punctuation","value":","},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Discount"},
+  {"type":"Operator","value":")"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"end"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n\n    "},
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// Applies the Discount to the Sales Order\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// \u003c/summary\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// \u003cparam name=\"SalesHeader\"\u003eSales Order\u003c/param\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"CommentSingle","value":"/// \u003cparam name=\"Discount\"\u003eDiscount to apply\u003c/param\u003e\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"Keyword","value":"local"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"procedure"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"Apply Discount\""},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"SalesHeader"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"record"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"Sales Header\""},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Discount"},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"Decimal"},
+  {"type":"Operator","value":")\n    "},
+  {"type":"Keyword","value":"begin"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"CommentSingle","value":"// TODO: Implement\n"},
+  {"type":"TextWhitespace","value":"    "},
+  {"type":"Keyword","value":"end"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n\n\n"},
+  {"type":"Keyword","value":"enum"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"50140"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"SomeEnum"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"value"},
+  {"type":"Operator","value":"("},
+  {"type":"LiteralNumber","value":"0"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"None"},
+  {"type":"Operator","value":") "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n\n"},
+  {"type":"CommentPreproc","value":"#region interface stuff\n"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Keyword","value":"interface"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"ISuperGreat"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"procedure"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"YesSir"},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"\"c in c\""},
+  {"type":"Punctuation","value":":"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"codeunit"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"FooBar"},
+  {"type":"Operator","value":")"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n\n"},
+  {"type":"CommentPreproc","value":"#endregion\n"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Keyword","value":"table"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"50100"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Customer"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"Access"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"="},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"Internal"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"TableType"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"="},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Normal"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":"\n\n    "},
+  {"type":"Keyword","value":"fields"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Keyword","value":"field"},
+  {"type":"Operator","value":"("},
+  {"type":"LiteralNumber","value":"1"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"P K\""},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"Integer"},
+  {"type":"Operator","value":")\n        "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n\n"},
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n/// Add the Loyalty fields to the Customer table.\n/// \u003c/summary\u003e\n"},
+  {"type":"Keyword","value":"tableextension"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"50100"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"LoyaltyCustomerExt"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"extends"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Customer"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"fields"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n"},
+  {"type":"TextWhitespace","value":"        "},
+  {"type":"CommentSingle","value":"/// Customer loyalty.\n"},
+  {"type":"TextWhitespace","value":"        "},
+  {"type":"CommentSingle","value":"/// \u003c/summary\u003e\n"},
+  {"type":"TextWhitespace","value":"        "},
+  {"type":"Keyword","value":"field"},
+  {"type":"Operator","value":"("},
+  {"type":"LiteralNumber","value":"50100"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Loyalty"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"enum"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"LoyaltyLevel"},
+  {"type":"Operator","value":")\n        "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n\n"},
+  {"type":"CommentSingle","value":"/// \u003csummary\u003e\n/// Adds the Loyalty field to the General group on the \"Customer Card\"\n/// \u003c/summary\u003e\n"},
+  {"type":"Keyword","value":"pageextension"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"LiteralNumber","value":"50100"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"LoyaltyCustCardExt"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Keyword","value":"extends"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"\"Customer Card\""},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Keyword","value":"layout"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Keyword","value":"addlast"},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"General"},
+  {"type":"Operator","value":")\n        "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":"\n            "},
+  {"type":"Keyword","value":"field"},
+  {"type":"Operator","value":"("},
+  {"type":"Text","value":"Loyalty"},
+  {"type":"Punctuation","value":";"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"Rec"},
+  {"type":"Operator","value":"."},
+  {"type":"Text","value":"Loyalty"},
+  {"type":"Operator","value":") "},
+  {"type":"Text","value":"{"},
+  {"type":"TextWhitespace","value":" "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n        "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n    "},
+  {"type":"Text","value":"}"},
+  {"type":"TextWhitespace","value":"\n"},
+  {"type":"Text","value":"}"}
+]