Added lexars
This commit is contained in:
parent
382b2ce94b
commit
f9f64b0558
820 changed files with 149371 additions and 0 deletions
lexers/testdata
abap.actualabap.expectedagda.actualagda.expectedal.actualal.expectedalloy.actualalloy.expected
analysis
bash.actualbash.expectedc.ifdef.actualc.ifdef.expectedc.ifndef.actualc.ifndef.expectedc.include.actualc.include.expectedcpp.include.actualcpp.include.expectedcpp.namespace.actualcpp.namespace.expectedmysql.backtick.actualmysql.backtick.expected
aql
comments.actualcomments.expectedfunctions.actualfunctions.expectedidentifiers.actualidentifiers.expectedkeywords.actualkeywords.expectednumbers.actualnumbers.expectedqueries.actualqueries.expectedstrings.actualstrings.expected
arduino.actualarduino.expectedarmasm.actualarmasm.expectedballerina.actualballerina.expectedbash-session.actualbash-session.expectedbash.actualbash.expectedbib.actualbib.expectedbicep
bicep-coalesce-operator.actualbicep-coalesce-operator.expectedbicep-comments.actualbicep-comments.expectedbicep-directives.actualbicep-directives.expectedbicep-function-any.actualbicep-function-any.expectedbicep-function-deployment.actualbicep-function-deployment.expectedbicep-function-logical.actualbicep-function-logical.expectedbicep-lambdas.actualbicep-lambdas.expectedbicep-module.actualbicep-module.expectedbicep-newlinesensitivity.actualbicep-newlinesensitivity.expectedbicep-output.actualbicep-output.expectedbicep-parameter-decoration.actualbicep-parameter-decoration.expectedbicep-resource-conditional.actualbicep-resource-conditional.expectedbicep-resource-multiple.actualbicep-resource-multiple.expectedbicep-string-singleline-multiline.actualbicep-string-singleline-multiline.expectedbicep-targetScope.actualbicep-targetScope.expectedbicep-types.actualbicep-types.expectedbicep-variable-string-interpolation.actualbicep-variable-string-interpolation.expected
bqn.actualbqn.expectedcaddyfile.actualcaddyfile.expectedcfengine3.actualcfengine3.expectedchapel.actualchapel.expectedcpp.actualcpp.expectedcql.actualcql.expectedcsharp
62
lexers/testdata/abap.actual
vendored
Normal file
62
lexers/testdata/abap.actual
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
*&---------------------------------------------------------------------*
|
||||
*& Report /WUE/AUFGABE_PRIMZAHL
|
||||
*&
|
||||
*&---------------------------------------------------------------------*
|
||||
*& Anmerkung: um bei einer Zahl entscheiden zu können, ob diese eine Primzahl ist,
|
||||
*& genügt es die Primzahlen zu prüfen die kleiner gleich der Würzel der Zahl sind
|
||||
*&
|
||||
*&---------------------------------------------------------------------*
|
||||
REPORT /wue/aufgabe_primzahl.
|
||||
|
||||
|
||||
PARAMETERS p_range TYPE i.
|
||||
|
||||
"Tabelle in der alle gefundenen Primzahlen gespeichert werden, die kleiner gleich
|
||||
"der Würzel der eingegebenen Zahl sind
|
||||
DATA gt_prim_num TYPE TABLE OF i.
|
||||
|
||||
"Diese Variable dient dazu, alle Zahlen <= der eingegebenen Zahl und >= 2 aufzustellen
|
||||
DATA g_number TYPE i VALUE 1.
|
||||
|
||||
"Diese Variable dient dazu, zu sagen, ob die aktuelle g_number eine Primzahl ist oder nicht
|
||||
DATA g_is_prime TYPE abap_bool.
|
||||
|
||||
"mit sqrt( zahl1 ) kann die Quadratwurzel der Zahl1 berechnet werden
|
||||
DATA(g_sqrt_range) = sqrt( p_range ).
|
||||
|
||||
|
||||
|
||||
"da die zu prüfenden Zahlen bei der 2 beginnend durch Addition von 1 aufgestellt werden
|
||||
"muss die Schleife lediglich p_range - 1 male durchlaufen werden
|
||||
DO p_range - 1 TIMES.
|
||||
|
||||
"zählt die zu prüfende Zahlen hoch
|
||||
ADD 1 TO g_number.
|
||||
|
||||
"grundsätzlich wird solange, bis es nicht widerlegt ist angenommen, dass g_number eine Primzahl ist
|
||||
g_is_prime = abap_true.
|
||||
|
||||
"Jede Zahl die in der Tabelle gt_prim_num enthalten ist wird geprüft, ob g_number durch diese ohne Rest teilbar ist
|
||||
LOOP AT gt_prim_num ASSIGNING FIELD-SYMBOL(<g_prim>).
|
||||
|
||||
"Durch Zahl1 MOD Zahl2 kann der Rest, der bei Zahl1 / Zahl2 herauskommt ermittelt werden
|
||||
"Sobald dieser bei g_number / <g_prim> 0 ist, handelt es sich bei g_number um keine Primzahl und somit muss diese nicht
|
||||
"weiter überprüft werden, folglich kann die Loop-Schleife mit EXIT verlassen werden
|
||||
IF g_number MOD <g_prim> = 0.
|
||||
g_is_prime = abap_false.
|
||||
EXIT.
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
"Wenn nicht widerlegt werden konnte, dass g_number eine Primzahl ist, wird diese ausgegeben
|
||||
IF g_is_prime = abap_true.
|
||||
|
||||
"Wenn die neu gefundene Primzahl <= g_sqrt_range, wird diese in die Tabelle gt_prim_num eingefügt (Erklärung siehe Anmerkung)
|
||||
IF g_number <= g_sqrt_range.
|
||||
INSERT g_number INTO TABLE gt_prim_num.
|
||||
ENDIF.
|
||||
WRITE g_number.
|
||||
ENDIF.
|
||||
|
||||
ENDDO.
|
208
lexers/testdata/abap.expected
vendored
Normal file
208
lexers/testdata/abap.expected
vendored
Normal file
|
@ -0,0 +1,208 @@
|
|||
[
|
||||
{"type":"CommentSingle","value":"*\u0026---------------------------------------------------------------------*"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026 Report /WUE/AUFGABE_PRIMZAHL"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026---------------------------------------------------------------------*"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026 Anmerkung: um bei einer Zahl entscheiden zu können, ob diese eine Primzahl ist,"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026 genügt es die Primzahlen zu prüfen die kleiner gleich der Würzel der Zahl sind"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"*\u0026---------------------------------------------------------------------*"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"REPORT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"/"},
|
||||
{"type":"NameVariable","value":"wue"},
|
||||
{"type":"Punctuation","value":"/"},
|
||||
{"type":"NameVariable","value":"aufgabe_primzahl"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n\n"},
|
||||
{"type":"Keyword","value":"PARAMETERS"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"p_range"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TYPE "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"\"Tabelle in der alle gefundenen Primzahlen gespeichert werden, die kleiner gleich\n\"der Würzel der eingegebenen Zahl sind\n"},
|
||||
{"type":"Keyword","value":"DATA"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"gt_prim_num"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TYPE TABLE OF"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"\"Diese Variable dient dazu, alle Zahlen \u003c= der eingegebenen Zahl und \u003e= 2 aufzustellen\n"},
|
||||
{"type":"Keyword","value":"DATA"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TYPE "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"VALUE"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"\"Diese Variable dient dazu, zu sagen, ob die aktuelle g_number eine Primzahl ist oder nicht\n"},
|
||||
{"type":"Keyword","value":"DATA"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_is_prime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TYPE "},
|
||||
{"type":"NameVariable","value":"abap_bool"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"\"mit sqrt( zahl1 ) kann die Quadratwurzel der Zahl1 berechnet werden\n"},
|
||||
{"type":"Keyword","value":"DATA"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"g_sqrt_range"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"sqrt"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"p_range"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":")."},
|
||||
{"type":"Text","value":"\n\n\n\n"},
|
||||
{"type":"CommentSingle","value":"\"da die zu prüfenden Zahlen bei der 2 beginnend durch Addition von 1 aufgestellt werden\n\"muss die Schleife lediglich p_range - 1 male durchlaufen werden\n"},
|
||||
{"type":"Keyword","value":"DO"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"p_range"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TIMES"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"zählt die zu prüfende Zahlen hoch\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"ADD"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TO"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"grundsätzlich wird solange, bis es nicht widerlegt ist angenommen, dass g_number eine Primzahl ist\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_is_prime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"abap_true"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"Jede Zahl die in der Tabelle gt_prim_num enthalten ist wird geprüft, ob g_number durch diese ohne Rest teilbar ist\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"LOOP AT "},
|
||||
{"type":"NameVariable","value":"gt_prim_num"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"ASSIGNING"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"FIELD"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"SYMBOL"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"\u003cg_prim\u003e"},
|
||||
{"type":"Punctuation","value":")."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"Durch Zahl1 MOD Zahl2 kann der Rest, der bei Zahl1 / Zahl2 herauskommt ermittelt werden\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"\"Sobald dieser bei g_number / \u003cg_prim\u003e 0 ist, handelt es sich bei g_number um keine Primzahl und somit muss diese nicht\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"\"weiter überprüft werden, folglich kann die Loop-Schleife mit EXIT verlassen werden\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"IF"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"MOD"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"\u003cg_prim\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameVariable","value":"g_is_prime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"abap_false"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"EXIT"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"ENDIF"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"Keyword","value":"ENDLOOP"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"Wenn nicht widerlegt werden konnte, dass g_number eine Primzahl ist, wird diese ausgegeben\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"IF"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_is_prime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"abap_true"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"\"Wenn die neu gefundene Primzahl \u003c= g_sqrt_range, wird diese in die Tabelle gt_prim_num eingefügt (Erklärung siehe Anmerkung)\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"IF"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u003c="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_sqrt_range"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"INSERT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"INTO"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"TABLE"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"gt_prim_num"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"ENDIF"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"WRITE"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"g_number"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"ENDIF"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"ENDDO"},
|
||||
{"type":"Punctuation","value":"."}
|
||||
]
|
12
lexers/testdata/agda.actual
vendored
Normal file
12
lexers/testdata/agda.actual
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
module hello-world where
|
||||
|
||||
open import Agda.Builtin.IO using (IO)
|
||||
open import Agda.Builtin.Unit using (⊤)
|
||||
open import Agda.Builtin.String using (String)
|
||||
|
||||
postulate putStrLn : String → IO ⊤
|
||||
{-# FOREIGN GHC import qualified Data.Text as T #-}
|
||||
{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}
|
||||
|
||||
main : IO ⊤
|
||||
main = putStrLn "Hello world!"
|
79
lexers/testdata/agda.expected
vendored
Normal file
79
lexers/testdata/agda.expected
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
[
|
||||
{"type":"KeywordReserved","value":"module"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"hello"},
|
||||
{"type":"Text","value":"-world"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"where"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordReserved","value":"open"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"import"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Agda.Builtin.IO"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"using"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"("},
|
||||
{"type":"Text","value":"IO"},
|
||||
{"type":"Operator","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordReserved","value":"open"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"import"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Agda.Builtin.Unit"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"using"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"("},
|
||||
{"type":"Text","value":"⊤"},
|
||||
{"type":"Operator","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordReserved","value":"open"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"import"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Agda.Builtin.String"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordReserved","value":"using"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"("},
|
||||
{"type":"Text","value":"String"},
|
||||
{"type":"Operator","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordReserved","value":"postulate"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"putStrLn"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"OperatorWord","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"String"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"OperatorWord","value":"→"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"IO"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"⊤"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentMultiline","value":"{-# FOREIGN GHC import qualified Data.Text as T #-}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentMultiline","value":"{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"NameFunction","value":"main"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"OperatorWord","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"IO"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"⊤"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Text","value":"main"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"OperatorWord","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"putStrLn"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\"Hello world!\""},
|
||||
{"type":"TextWhitespace","value":"\n"}
|
||||
]
|
98
lexers/testdata/al.actual
vendored
Normal file
98
lexers/testdata/al.actual
vendored
Normal file
|
@ -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) { }
|
||||
}
|
||||
}
|
||||
}
|
342
lexers/testdata/al.expected
vendored
Normal file
342
lexers/testdata/al.expected
vendored
Normal file
|
@ -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":"}"}
|
||||
]
|
16
lexers/testdata/alloy.actual
vendored
Normal file
16
lexers/testdata/alloy.actual
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
sig Node {
|
||||
edges: set Node
|
||||
}
|
||||
|
||||
fact "Connected graph" {
|
||||
some n: Node | n.*edges = Node
|
||||
}
|
||||
|
||||
fact "No self edges" {
|
||||
no iden & edges
|
||||
}
|
||||
|
||||
one sig Ball {
|
||||
-- note the var
|
||||
var loc: Node
|
||||
}
|
77
lexers/testdata/alloy.expected
vendored
Normal file
77
lexers/testdata/alloy.expected
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"sig"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Node"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Name","value":"edges"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Keyword","value":"set"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Node"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Keyword","value":"fact"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\"Connected graph\""},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Keyword","value":"some"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"n"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Node"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"|"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"n"},
|
||||
{"type":"Operator","value":".*"},
|
||||
{"type":"Name","value":"edges"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Node"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Keyword","value":"fact"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\"No self edges\""},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Keyword","value":"no"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"iden"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u0026"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"edges"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Keyword","value":"one"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"sig"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Ball"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"CommentSingle","value":"-- note the var"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Keyword","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"loc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"Node"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"}
|
||||
]
|
3
lexers/testdata/analysis/bash.actual
vendored
Normal file
3
lexers/testdata/analysis/bash.actual
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "This is a bash script"
|
1
lexers/testdata/analysis/bash.expected
vendored
Normal file
1
lexers/testdata/analysis/bash.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
1
|
2
lexers/testdata/analysis/c.ifdef.actual
vendored
Normal file
2
lexers/testdata/analysis/c.ifdef.actual
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
#ifdef DEBUG
|
1
lexers/testdata/analysis/c.ifdef.expected
vendored
Normal file
1
lexers/testdata/analysis/c.ifdef.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.1
|
2
lexers/testdata/analysis/c.ifndef.actual
vendored
Normal file
2
lexers/testdata/analysis/c.ifndef.actual
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
#ifndef DEBUG
|
1
lexers/testdata/analysis/c.ifndef.expected
vendored
Normal file
1
lexers/testdata/analysis/c.ifndef.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.1
|
2
lexers/testdata/analysis/c.include.actual
vendored
Normal file
2
lexers/testdata/analysis/c.include.actual
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
#include <stdio.h>
|
1
lexers/testdata/analysis/c.include.expected
vendored
Normal file
1
lexers/testdata/analysis/c.include.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.1
|
1
lexers/testdata/analysis/cpp.include.actual
vendored
Normal file
1
lexers/testdata/analysis/cpp.include.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include <iostream>
|
1
lexers/testdata/analysis/cpp.include.expected
vendored
Normal file
1
lexers/testdata/analysis/cpp.include.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.2
|
1
lexers/testdata/analysis/cpp.namespace.actual
vendored
Normal file
1
lexers/testdata/analysis/cpp.namespace.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
using namespace std;
|
1
lexers/testdata/analysis/cpp.namespace.expected
vendored
Normal file
1
lexers/testdata/analysis/cpp.namespace.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.4
|
1
lexers/testdata/analysis/mysql.backtick.actual
vendored
Normal file
1
lexers/testdata/analysis/mysql.backtick.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
CREATE TABLE `my_table` (id INT);
|
1
lexers/testdata/analysis/mysql.backtick.expected
vendored
Normal file
1
lexers/testdata/analysis/mysql.backtick.expected
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.5
|
5
lexers/testdata/aql/comments.actual
vendored
Normal file
5
lexers/testdata/aql/comments.actual
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
code//comment
|
||||
code/*comment*/
|
||||
/* comment RETURN 42 "'` *
|
||||
multiline */code
|
||||
white space
|
13
lexers/testdata/aql/comments.expected
vendored
Normal file
13
lexers/testdata/aql/comments.expected
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
[
|
||||
{"type":"Name","value":"code"},
|
||||
{"type":"CommentSingle","value":"//comment\n"},
|
||||
{"type":"Name","value":"code"},
|
||||
{"type":"CommentMultiline","value":"/*comment*/"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentMultiline","value":"/* comment RETURN 42 \"'` *\nmultiline */"},
|
||||
{"type":"Name","value":"code"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"white"},
|
||||
{"type":"Text","value":" \t"},
|
||||
{"type":"Name","value":"space"}
|
||||
]
|
14
lexers/testdata/aql/functions.actual
vendored
Normal file
14
lexers/testdata/aql/functions.actual
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
RAND()
|
||||
rand ()
|
||||
Collections()
|
||||
COUNT_DISTINCT()
|
||||
COUNT()
|
||||
not_null()
|
||||
REMOVE_VALUE()
|
||||
group::func()
|
||||
GROUP_57::F9_()
|
||||
|
||||
0::0()
|
||||
1SUM()
|
||||
_G::A()
|
||||
_aql::avg()
|
48
lexers/testdata/aql/functions.expected
vendored
Normal file
48
lexers/testdata/aql/functions.expected
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
[
|
||||
{"type":"NameFunction","value":"RAND"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"rand"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"Collections"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"COUNT_DISTINCT"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"COUNT"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"not_null"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"REMOVE_VALUE"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"group::func"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameFunction","value":"GROUP_57::F9_"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Operator","value":"::"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"NameFunction","value":"SUM"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"_G"},
|
||||
{"type":"Operator","value":"::"},
|
||||
{"type":"Name","value":"A"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"_aql"},
|
||||
{"type":"Operator","value":"::"},
|
||||
{"type":"NameFunction","value":"avg"},
|
||||
{"type":"Punctuation","value":"()"}
|
||||
]
|
19
lexers/testdata/aql/identifiers.actual
vendored
Normal file
19
lexers/testdata/aql/identifiers.actual
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
i
|
||||
doc
|
||||
Vertex
|
||||
n036
|
||||
$X
|
||||
__foo__
|
||||
`FILTER`
|
||||
`@12 3!`
|
||||
´&tab FOR äöü´
|
||||
`multi\`
|
||||
\\\`
|
||||
line`
|
||||
´multi\´
|
||||
\\\´
|
||||
line´
|
||||
|
||||
$6
|
||||
$_Y
|
||||
_8
|
32
lexers/testdata/aql/identifiers.expected
vendored
Normal file
32
lexers/testdata/aql/identifiers.expected
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
[
|
||||
{"type":"Name","value":"i"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"Vertex"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"n036"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"$X"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"__foo__"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"`FILTER`"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"`@12 3!`"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"´\u0026tab\tFOR äöü´"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"`multi\\`\n\\\\\\`\nline`"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"´multi\\´\n\\\\\\´\nline´"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Error","value":"$"},
|
||||
{"type":"LiteralNumberInteger","value":"6"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Error","value":"$"},
|
||||
{"type":"Name","value":"_Y"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Error","value":"_"},
|
||||
{"type":"LiteralNumberInteger","value":"8"}
|
||||
]
|
31
lexers/testdata/aql/keywords.actual
vendored
Normal file
31
lexers/testdata/aql/keywords.actual
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
LET
|
||||
AT LEAST
|
||||
NULL
|
||||
nULL
|
||||
true
|
||||
false
|
||||
TRUE
|
||||
FALSE
|
||||
True
|
||||
fAlSe
|
||||
WITH COUNT INTO
|
||||
KEEP
|
||||
prune
|
||||
SEARCH
|
||||
to
|
||||
OPTIONS {}
|
||||
options{}
|
||||
CURRENT
|
||||
NEW
|
||||
OLD
|
||||
|
||||
LEAST
|
||||
AT
|
||||
CAT LEAST
|
||||
KNULL
|
||||
falsey
|
||||
COUNT
|
||||
OPTIONS
|
||||
current
|
||||
New
|
||||
old
|
70
lexers/testdata/aql/keywords.expected
vendored
Normal file
70
lexers/testdata/aql/keywords.expected
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"LET"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordReserved","value":"AT LEAST"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"NULL"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"nULL"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"false"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"TRUE"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"FALSE"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"True"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"fAlSe"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordReserved","value":"WITH"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordPseudo","value":"COUNT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"INTO"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"KEEP"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"prune"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"SEARCH"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"to"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"OPTIONS"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"options"},
|
||||
{"type":"Punctuation","value":"{}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameBuiltinPseudo","value":"CURRENT"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameBuiltinPseudo","value":"NEW"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameBuiltinPseudo","value":"OLD"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Name","value":"LEAST"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"AT"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"CAT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"LEAST"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"KNULL"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"falsey"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"COUNT"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"OPTIONS"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"current"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"New"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"old"}
|
||||
]
|
9
lexers/testdata/aql/numbers.actual
vendored
Normal file
9
lexers/testdata/aql/numbers.actual
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
0b1100 0B1
|
||||
0xC0DE 0Xa7
|
||||
0.0 -1.23 .5 8e9 3.33E-3 456.7e+89
|
||||
0 2 400
|
||||
|
||||
0B 0b1e
|
||||
0x 0X5G
|
||||
00.7 .e6 ..5
|
||||
01
|
52
lexers/testdata/aql/numbers.expected
vendored
Normal file
52
lexers/testdata/aql/numbers.expected
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
[
|
||||
{"type":"LiteralNumberBin","value":"0b1100"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberBin","value":"0B1"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberHex","value":"0xC0DE"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberHex","value":"0Xa7"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberFloat","value":"0.0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"LiteralNumberFloat","value":"1.23"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":".5"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":"8e9"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":"3.33E-3"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"45"},
|
||||
{"type":"LiteralNumberFloat","value":"6.7e+89"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"2"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"400"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Name","value":"B"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberBin","value":"0b1"},
|
||||
{"type":"Name","value":"e"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Name","value":"x"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberHex","value":"0X5"},
|
||||
{"type":"Name","value":"G"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"LiteralNumberFloat","value":"0.7"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"e6"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":".."},
|
||||
{"type":"LiteralNumberInteger","value":"5"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralNumberInteger","value":"01"}
|
||||
]
|
12
lexers/testdata/aql/queries.actual
vendored
Normal file
12
lexers/testdata/aql/queries.actual
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
FOR doc IN @@coll
|
||||
FILTER doc.value >= @val && doc["value"] < COUNT ([.1, FALSE])
|
||||
COLLECT ´v a l´ /* legal! */ = doc.value WITH COUNT INTO count // blarg
|
||||
RETURN MERGE(doc, { [CONCAT("new", 0.125)]: true } )
|
||||
|
||||
LET arr = [[1,2],3,[0]]
|
||||
RETURN arr[** FILTER CURRENT % 2 == 0 RETURN CURRENT||null]
|
||||
|
||||
FOR v,e,p IN 2..4 OUTBOUND "components/S" GRAPH "g"
|
||||
PRUNE e != null AND p.edges[-1].text =~ @AND
|
||||
OPTIONS { vertexCollections: ['components'] }
|
||||
RETURN v.´sort´ ?: 0xBEEF
|
194
lexers/testdata/aql/queries.expected
vendored
Normal file
194
lexers/testdata/aql/queries.expected
vendored
Normal file
|
@ -0,0 +1,194 @@
|
|||
[
|
||||
{"type":"KeywordReserved","value":"FOR"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"IN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariableGlobal","value":"@@coll"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"FILTER"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"value"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u003e="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"@val"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u0026\u0026"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralStringDouble","value":"\"value\""},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"COUNT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralNumberFloat","value":".1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"FALSE"},
|
||||
{"type":"Punctuation","value":"])"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"COLLECT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"´v a l´"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentMultiline","value":"/* legal! */"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"value"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"WITH"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordPseudo","value":"COUNT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"INTO"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"count"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// blarg\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"RETURN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"MERGE"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"doc"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameFunction","value":"CONCAT"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralStringDouble","value":"\"new\""},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":"0.125"},
|
||||
{"type":"Punctuation","value":")]"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"LET"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"arr"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"[["},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"LiteralNumberInteger","value":"2"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"LiteralNumberInteger","value":"3"},
|
||||
{"type":"Punctuation","value":",["},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":"]]"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordReserved","value":"RETURN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"arr"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"Operator","value":"**"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"FILTER"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameBuiltinPseudo","value":"CURRENT"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"%"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"2"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"RETURN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameBuiltinPseudo","value":"CURRENT"},
|
||||
{"type":"Operator","value":"||"},
|
||||
{"type":"KeywordConstant","value":"null"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordReserved","value":"FOR"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"v"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Name","value":"e"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Name","value":"p"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"IN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":"2"},
|
||||
{"type":"Operator","value":".."},
|
||||
{"type":"LiteralNumberInteger","value":"4"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"OUTBOUND"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"components/S\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"GRAPH"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"g\""},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordPseudo","value":"PRUNE"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"!="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"null"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"AND"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"p"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"edges"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Punctuation","value":"]."},
|
||||
{"type":"Name","value":"text"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=~"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"@AND"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordPseudo","value":"OPTIONS"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"vertexCollections"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralStringSingle","value":"'components'"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"RETURN"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"v"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"´sort´"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"?:"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberHex","value":"0xBEEF"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
12
lexers/testdata/aql/strings.actual
vendored
Normal file
12
lexers/testdata/aql/strings.actual
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
"double"
|
||||
'single'
|
||||
"multi
|
||||
line"
|
||||
'multi
|
||||
line'
|
||||
"escaped\"
|
||||
quote"
|
||||
'escaped\'
|
||||
quote'
|
||||
"backtick\\'"
|
||||
'backtick\\"'
|
17
lexers/testdata/aql/strings.expected
vendored
Normal file
17
lexers/testdata/aql/strings.expected
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
{"type":"LiteralStringDouble","value":"\"double\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringSingle","value":"'single'"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringDouble","value":"\"multi\nline\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringSingle","value":"'multi\nline'"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringDouble","value":"\"escaped\\\"\nquote\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringSingle","value":"'escaped\\'\nquote'"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringDouble","value":"\"backtick\\\\'\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"LiteralStringSingle","value":"'backtick\\\\\"'"}
|
||||
]
|
87
lexers/testdata/arduino.actual
vendored
Normal file
87
lexers/testdata/arduino.actual
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include <Servo.h>
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
Servo elbow_servo;
|
||||
Servo wrist_servo;
|
||||
const int potpin = 0; // analog pin used to connect the potentiometer
|
||||
int val; // variable to read the value from the analog pin
|
||||
|
||||
//// button cycles through controlling each color
|
||||
//// in the neopixel. state 0=stop, 1=red, 2=blue, 3=green, 4=all/white
|
||||
const int button_pin = 4;
|
||||
int buttonState; // the current reading from the input pin
|
||||
int lastButtonState = HIGH; // the previous reading from the input pin
|
||||
// the following variables are unsigned longs because the time, measured in
|
||||
// milliseconds, will quickly become a bigger number than can be stored in an int.
|
||||
unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
|
||||
unsigned long debounceDelay = 50; // the debounce time; increase if the output flickers
|
||||
int led_control_state = 0;
|
||||
|
||||
const int pixel_pin = 6;
|
||||
const int num_leds = 2;
|
||||
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(num_leds, pixel_pin, NEO_GRB + NEO_KHZ800);
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int blue = 0;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
elbow_servo.attach(9); // attaches the servo on pin 9 to the servo object
|
||||
pinMode(button_pin, INPUT_PULLUP); // create a button for the neopixels
|
||||
pixel.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
//// Read signal from variable resistor or potentiometer
|
||||
//
|
||||
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
|
||||
int v = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
|
||||
elbow_servo.write(v);
|
||||
delay(15); // waits for the servo to get there
|
||||
|
||||
|
||||
//// Toggle between states using a button
|
||||
////
|
||||
int b = digitalRead(button_pin); // read button
|
||||
// "debounce" the button signal
|
||||
if (b != lastButtonState) lastDebounceTime = millis();
|
||||
if ((millis() - lastDebounceTime) > debounceDelay) {
|
||||
if (b != buttonState) {
|
||||
buttonState = b;
|
||||
if (buttonState == LOW) {
|
||||
led_control_state++;
|
||||
if (led_control_state > 3) led_control_state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastButtonState = b;
|
||||
|
||||
switch(led_control_state) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
red = 255;
|
||||
blue = 255;
|
||||
green = 0;
|
||||
break;
|
||||
case 2:
|
||||
red = 0;
|
||||
blue = 255;
|
||||
green = 255;
|
||||
break;
|
||||
case 3:
|
||||
red = 255;
|
||||
blue = 0;
|
||||
green = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
Serial.println(led_control_state);
|
||||
// set color ofpixels
|
||||
for(int i=0;i<num_leds;i++){
|
||||
pixel.setPixelColor(i,red,green,blue);
|
||||
pixel.show();
|
||||
delay(15);
|
||||
}
|
||||
}
|
545
lexers/testdata/arduino.expected
vendored
Normal file
545
lexers/testdata/arduino.expected
vendored
Normal file
|
@ -0,0 +1,545 @@
|
|||
[
|
||||
{"type":"CommentPreproc","value":"#include"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentPreprocFile","value":"\u003cServo.h\u003e"},
|
||||
{"type":"CommentPreproc","value":"\n#include"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentPreprocFile","value":"\u003cAdafruit_NeoPixel.h\u003e"},
|
||||
{"type":"CommentPreproc","value":"\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameClass","value":"Servo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"elbow_servo"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" \n"},
|
||||
{"type":"NameClass","value":"Servo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"wrist_servo"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"const"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"potpin"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// analog pin used to connect the potentiometer\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"val"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// variable to read the value from the analog pin\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"//// button cycles through controlling each color\n//// in the neopixel. state 0=stop, 1=red, 2=blue, 3=green, 4=all/white\n"},
|
||||
{"type":"Keyword","value":"const"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"button_pin"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"4"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"buttonState"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// the current reading from the input pin\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"lastButtonState"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"HIGH"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// the previous reading from the input pin\n// the following variables are unsigned longs because the time, measured in\n// milliseconds, will quickly become a bigger number than can be stored in an int.\n"},
|
||||
{"type":"KeywordType","value":"unsigned"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"long"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"lastDebounceTime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// the last time the output pin was toggled\n"},
|
||||
{"type":"KeywordType","value":"unsigned"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"long"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"debounceDelay"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"50"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// the debounce time; increase if the output flickers\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"const"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"pixel_pin"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"6"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"const"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"num_leds"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"2"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"Adafruit_NeoPixel"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"pixel"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"Adafruit_NeoPixel"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"num_leds"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"pixel_pin"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"NEO_GRB"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"NEO_KHZ800"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"red"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"green"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"blue"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"setup"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameClass","value":"Serial"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"begin"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralNumberInteger","value":"9600"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"elbow_servo"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"attach"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralNumberInteger","value":"9"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// attaches the servo on pin 9 to the servo object\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"pinMode"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"button_pin"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"INPUT_PULLUP"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// create a button for the neopixels\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"pixel"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"begin"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"loop"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n \n "},
|
||||
{"type":"CommentSingle","value":"//// Read signal from variable resistor or potentiometer\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"//\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"val"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"analogRead"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"potpin"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// reads the value of the potentiometer (value between 0 and 1023)\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"v"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"val"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1023"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"180"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// scale it to use it with the servo (value between 0 and 180)\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"elbow_servo"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"write"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"v"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" \n "},
|
||||
{"type":"NameFunction","value":"delay"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralNumberInteger","value":"15"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// waits for the servo to get there\n"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"CommentSingle","value":"//// Toggle between states using a button\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"////\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"digitalRead"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"button_pin"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// read button\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// \"debounce\" the button signal\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"!="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"lastButtonState"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"lastDebounceTime"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"millis"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"(("},
|
||||
{"type":"NameFunction","value":"millis"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"lastDebounceTime"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"debounceDelay"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"!="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"buttonState"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"buttonState"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"buttonState"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordConstant","value":"LOW"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Operator","value":"++"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"lastButtonState"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"Keyword","value":"switch"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"case"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"break"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" \n "},
|
||||
{"type":"Keyword","value":"case"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"red"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"blue"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"green"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"break"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"case"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"2"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"red"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"blue"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"green"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"break"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"case"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"3"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"red"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"blue"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"green"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"255"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"break"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"NameClass","value":"Serial"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"println"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"led_control_state"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"CommentSingle","value":"// set color ofpixels\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"for"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"i"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Name","value":"i"},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"Name","value":"num_leds"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Name","value":"i"},
|
||||
{"type":"Operator","value":"++"},
|
||||
{"type":"Punctuation","value":"){"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"pixel"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"setPixelColor"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Name","value":"i"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Name","value":"red"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Name","value":"green"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Name","value":"blue"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"pixel"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"show"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":" \n "},
|
||||
{"type":"NameFunction","value":"delay"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralNumberInteger","value":"15"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Text","value":" \n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
17
lexers/testdata/armasm.actual
vendored
Normal file
17
lexers/testdata/armasm.actual
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
@ Hello World in ARM Assembly for Linux system
|
||||
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
mov r7, #4 @ Setup service call 4 (write)
|
||||
mov r0, #1 @ param 1 - File descriptor 1 = stdout
|
||||
ldr r1, =hello @ param 2 - address of string to print
|
||||
mov r2, #13 @ param 3 - length of hello world string
|
||||
svc 0 @ ask linux to write to stdout
|
||||
|
||||
mov r7, #1 @ Setup service call 1 (exit)
|
||||
mov r0, #0 @ param 1 - 0 = normal exit
|
||||
svc 0 @ ask linux to terminate us
|
||||
|
||||
.data
|
||||
hello: .ascii "Hello World!\n"
|
62
lexers/testdata/armasm.expected
vendored
Normal file
62
lexers/testdata/armasm.expected
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
[
|
||||
{"type":"CommentSingle","value":"@ Hello World in ARM Assembly for Linux system\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordNamespace","value":".global"},
|
||||
{"type":"NameLabel","value":" _start\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameLabel","value":"_start"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"Text","value":"\n mov "},
|
||||
{"type":"NameClass","value":"r7"},
|
||||
{"type":"Text","value":", #"},
|
||||
{"type":"LiteralNumberInteger","value":"4"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ Setup service call 4 (write)\n"},
|
||||
{"type":"Text","value":" mov "},
|
||||
{"type":"NameClass","value":"r0"},
|
||||
{"type":"Text","value":", #"},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ param 1 - File descriptor 1 = stdout\n"},
|
||||
{"type":"Text","value":" ldr "},
|
||||
{"type":"NameClass","value":"r1"},
|
||||
{"type":"Text","value":", ="},
|
||||
{"type":"NameLabel","value":"hello"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ param 2 - address of string to print\n"},
|
||||
{"type":"Text","value":" mov "},
|
||||
{"type":"NameClass","value":"r2"},
|
||||
{"type":"Text","value":", #"},
|
||||
{"type":"LiteralNumberInteger","value":"13"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ param 3 - length of hello world string\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameNamespace","value":"svc 0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ ask linux to write to stdout\n"},
|
||||
{"type":"Text","value":"\n mov "},
|
||||
{"type":"NameClass","value":"r7"},
|
||||
{"type":"Text","value":", #"},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ Setup service call 1 (exit)\n"},
|
||||
{"type":"Text","value":" mov "},
|
||||
{"type":"NameClass","value":"r0"},
|
||||
{"type":"Text","value":", #"},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ param 1 - 0 = normal exit\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameNamespace","value":"svc 0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"@ ask linux to terminate us\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordNamespace","value":".data"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameLabel","value":"hello"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"KeywordNamespace","value":" .ascii "},
|
||||
{"type":"Punctuation","value":"\""},
|
||||
{"type":"LiteralStringDouble","value":"Hello World!\\n"},
|
||||
{"type":"Punctuation","value":"\""}
|
||||
]
|
5
lexers/testdata/ballerina.actual
vendored
Normal file
5
lexers/testdata/ballerina.actual
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import ballerina/http;
|
||||
|
||||
endpoint http:Listener listener {
|
||||
port: 9090
|
||||
};
|
26
lexers/testdata/ballerina.expected
vendored
Normal file
26
lexers/testdata/ballerina.expected
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
[
|
||||
{"type":"KeywordNamespace","value":"import"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameNamespace","value":"ballerina"},
|
||||
{"type":"Operator","value":"/"},
|
||||
{"type":"Name","value":"http"},
|
||||
{"type":"Operator","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"endpoint"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"http"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Name","value":"Listener"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"listener"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"port"},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"9090"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Operator","value":"};"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
15
lexers/testdata/bash-session.actual
vendored
Normal file
15
lexers/testdata/bash-session.actual
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
$ echo "Hello, world!"
|
||||
Hello, world!
|
||||
% pwd
|
||||
/User/foo
|
||||
> make -j build
|
||||
%ls | wc -l
|
||||
5
|
||||
[user@host]$ whoami
|
||||
user
|
||||
[user@host] # id
|
||||
uid=1000(user) gid=1000(user) groups=1000(user)
|
||||
[super user :D@super host :D] %if [ 1 -eq 1 ]; then uname; fi
|
||||
Linux
|
||||
[user@host]%echo $((1+1))
|
||||
2
|
56
lexers/testdata/bash-session.expected
vendored
Normal file
56
lexers/testdata/bash-session.expected
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
[
|
||||
{"type":"GenericPrompt","value":"$"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameBuiltin","value":"echo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"Hello, world!\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"GenericOutput","value":"Hello, world!\n"},
|
||||
{"type":"GenericPrompt","value":"%"},
|
||||
{"type":"Text","value":"\t"},
|
||||
{"type":"NameBuiltin","value":"pwd"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"GenericOutput","value":"/User/foo\n"},
|
||||
{"type":"GenericPrompt","value":"\u003e"},
|
||||
{"type":"Text","value":" make -j build\n"},
|
||||
{"type":"GenericPrompt","value":"%"},
|
||||
{"type":"Text","value":"ls "},
|
||||
{"type":"Punctuation","value":"|"},
|
||||
{"type":"Text","value":" wc -l\n"},
|
||||
{"type":"GenericOutput","value":"5\n"},
|
||||
{"type":"GenericPrompt","value":"[user@host]$"},
|
||||
{"type":"Text","value":" whoami\n"},
|
||||
{"type":"GenericOutput","value":"user\n"},
|
||||
{"type":"GenericPrompt","value":"[user@host] #"},
|
||||
{"type":"Text","value":" id\n"},
|
||||
{"type":"GenericOutput","value":"uid=1000(user) gid=1000(user) groups=1000(user)\n"},
|
||||
{"type":"GenericPrompt","value":"[super user :D@super host :D] %"},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"["},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"Text","value":" -eq "},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"]"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"then"},
|
||||
{"type":"Text","value":" uname"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"fi"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"GenericOutput","value":"Linux\n"},
|
||||
{"type":"GenericPrompt","value":"[user@host]%"},
|
||||
{"type":"NameBuiltin","value":"echo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"$(("},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"Keyword","value":"))"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"GenericOutput","value":"2\n"}
|
||||
]
|
49
lexers/testdata/bash.actual
vendored
Normal file
49
lexers/testdata/bash.actual
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# Install fish
|
||||
|
||||
brew install fish
|
||||
|
||||
# Add fish to your list of available shells
|
||||
|
||||
echo "/usr/local/bin/fish/" | sudo tee -a /etc/shells
|
||||
|
||||
# Make fish the defaul shell
|
||||
|
||||
chsh -s /usr/local/bin/fish
|
||||
|
||||
# Restart the terminal to load fish shell
|
||||
|
||||
|
||||
# Code snippet from https://github.com/gmarik/gist.sh/blob/master/gist.sh
|
||||
gist_clone ()
|
||||
{
|
||||
if [ "$_PRIVATE" = "1" ]; then
|
||||
URL="git@gist.github.com:$1.git"
|
||||
else
|
||||
URL="git://gist.github.com/$1.git"
|
||||
fi
|
||||
|
||||
log "* cloning Gist from $URL"
|
||||
|
||||
CMD="git clone $URL gist-$1"
|
||||
|
||||
if [ "$_DEBUG" = "1" ]; then
|
||||
echo $CMD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$CMD
|
||||
}
|
||||
|
||||
# Code snippet from https://gist.github.com/thejefflarson/885812
|
||||
tiger_em () {
|
||||
directory=$WD/$1
|
||||
shift
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
get_em $directory "ftp://ftp2.census.gov/geo/tiger/TIGER2010/"$1
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# bare comment marker
|
||||
#
|
139
lexers/testdata/bash.expected
vendored
Normal file
139
lexers/testdata/bash.expected
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
[
|
||||
{"type":"CommentSingle","value":"# Install fish"},
|
||||
{"type":"Text","value":"\n\nbrew install fish\n\n"},
|
||||
{"type":"CommentSingle","value":"# Add fish to your list of available shells"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"NameBuiltin","value":"echo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"/usr/local/bin/fish/\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"|"},
|
||||
{"type":"Text","value":" sudo tee -a /etc/shells\n\n"},
|
||||
{"type":"CommentSingle","value":"# Make fish the defaul shell"},
|
||||
{"type":"Text","value":"\n\nchsh -s /usr/local/bin/fish\n\n"},
|
||||
{"type":"CommentSingle","value":"# Restart the terminal to load fish shell"},
|
||||
{"type":"Text","value":"\n\n\n"},
|
||||
{"type":"CommentSingle","value":"# Code snippet from https://github.com/gmarik/gist.sh/blob/master/gist.sh"},
|
||||
{"type":"Text","value":"\ngist_clone "},
|
||||
{"type":"Operator","value":"()"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"["},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"NameVariable","value":"$_PRIVATE"},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"1\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"]"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"then"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameVariable","value":"URL"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"LiteralStringDouble","value":"\"git@gist.github.com:"},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"LiteralStringDouble","value":".git\""},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"else"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameVariable","value":"URL"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"LiteralStringDouble","value":"\"git://gist.github.com/"},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"LiteralStringDouble","value":".git\""},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"fi"},
|
||||
{"type":"Text","value":"\n\n log "},
|
||||
{"type":"LiteralStringDouble","value":"\"* cloning Gist from "},
|
||||
{"type":"NameVariable","value":"$URL"},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"NameVariable","value":"CMD"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"LiteralStringDouble","value":"\"git clone "},
|
||||
{"type":"NameVariable","value":"$URL"},
|
||||
{"type":"LiteralStringDouble","value":" gist-"},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"["},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"NameVariable","value":"$_DEBUG"},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"1\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"]"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"then"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameBuiltin","value":"echo"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameVariable","value":"$CMD"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameBuiltin","value":"exit"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumber","value":"0"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"fi"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"NameVariable","value":"$CMD"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# Code snippet from https://gist.github.com/thejefflarson/885812"},
|
||||
{"type":"Text","value":"\ntiger_em "},
|
||||
{"type":"Operator","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameVariable","value":"directory"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"NameVariable","value":"$WD"},
|
||||
{"type":"Text","value":"/"},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameBuiltin","value":"shift"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"until"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"["},
|
||||
{"type":"Text","value":" -z "},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"]"},
|
||||
{"type":"Text","value":" \n "},
|
||||
{"type":"Keyword","value":"do"},
|
||||
{"type":"Text","value":"\n get_em "},
|
||||
{"type":"NameVariable","value":"$directory"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"ftp://ftp2.census.gov/geo/tiger/TIGER2010/\""},
|
||||
{"type":"NameVariable","value":"$1"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"NameBuiltin","value":"shift"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"done"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Operator","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# bare comment marker"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentSingle","value":"#"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
22
lexers/testdata/bib.actual
vendored
Normal file
22
lexers/testdata/bib.actual
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
% a sample bibliography file
|
||||
%
|
||||
|
||||
@article{small,
|
||||
author = {Freely, I.P.},
|
||||
title = {A small paper},
|
||||
journal = {The journal of small papers},
|
||||
year = 1997,
|
||||
volume = {-1},
|
||||
note = {to appear},
|
||||
}
|
||||
|
||||
@article{big,
|
||||
author = {Jass, Hugh},
|
||||
title = {A big paper},
|
||||
journal = {The journal of big papers},
|
||||
year = 7991,
|
||||
volume = {MCMXCVII},
|
||||
}
|
||||
|
||||
% The authors mentioned here are almost, but not quite,
|
||||
% entirely unrelated to Matt Groening.
|
101
lexers/testdata/bib.expected
vendored
Normal file
101
lexers/testdata/bib.expected
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
[
|
||||
{"type":"Comment","value":"% a sample bibliography file"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Comment","value":"% "},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"NameClass","value":"@article"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"NameLabel","value":"small"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"author"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{Freely, I.P.}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"title"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{A small paper}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"journal"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{The journal of small papers}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"year"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumber","value":"1997"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"volume"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{-1}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"note"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{to appear}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"NameClass","value":"@article"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"NameLabel","value":"big"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"author"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{Jass, Hugh}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"title"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{A big paper}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"journal"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{The journal of big papers}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"year"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumber","value":"7991"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"volume"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"{MCMXCVII}"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Comment","value":"% The authors mentioned here are almost, but not quite,"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Comment","value":"% entirely unrelated to Matt Groening."},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
1
lexers/testdata/bicep/bicep-coalesce-operator.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-coalesce-operator.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
output nonNullStr string = myObject.isnull1 ?? myObject.string ?? myObject.isnull2
|
25
lexers/testdata/bicep/bicep-coalesce-operator.expected
vendored
Normal file
25
lexers/testdata/bicep/bicep-coalesce-operator.expected
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"nonNullStr"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"isnull1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"??"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"??"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"isnull2"}
|
||||
]
|
22
lexers/testdata/bicep/bicep-comments.actual
vendored
Normal file
22
lexers/testdata/bicep/bicep-comments.actual
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// This is your primary NIC.
|
||||
resource nic1 'Microsoft.Network/networkInterfaces@2020-06-01' = {
|
||||
}
|
||||
|
||||
/*
|
||||
This Bicep file assumes the key vault already exists and
|
||||
is in same subscription and resource group as the deployment.
|
||||
*/
|
||||
param existingKeyVaultName string
|
||||
|
||||
resource test 'Microsoft.AAD/domainServices@2021-03-01' = {
|
||||
name: 'asdfsdf'
|
||||
// this is a comment
|
||||
properties: {/*comment*/
|
||||
domainConfigurationType/*comment*/:/*comment*/'as//notacomment!d/* also not a comment */fsdf'// test!/*
|
||||
/* multi
|
||||
line
|
||||
comment */ domainName: /*
|
||||
asdf*/'test'
|
||||
// comment
|
||||
}
|
||||
}
|
121
lexers/testdata/bicep/bicep-comments.expected
vendored
Normal file
121
lexers/testdata/bicep/bicep-comments.expected
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
[
|
||||
{"type":"CommentSingle","value":"// This is your primary NIC."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"nic1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Network/networkInterfaces@2020-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Operator","value":"/*"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"This"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"Bicep"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"file"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"assumes"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"the"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"vault"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"already"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"exists"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"and"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"is"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"same"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"subscription"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"and"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"group"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"as"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"the"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"deployment"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"*/"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"existingKeyVaultName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"test"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.AAD/domainServices@2021-03-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'asdfsdf'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"CommentSingle","value":"// this is a comment"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"CommentMultiline","value":"/*comment*/"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"domainConfigurationType"},
|
||||
{"type":"CommentMultiline","value":"/*comment*/"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"CommentMultiline","value":"/*comment*/"},
|
||||
{"type":"LiteralString","value":"'as//notacomment!d/* also not a comment */fsdf'"},
|
||||
{"type":"CommentSingle","value":"// test!/*"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Operator","value":"/*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"multi"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"line"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"comment"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*/"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"domainName"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"/*"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"asdf"},
|
||||
{"type":"Operator","value":"*/"},
|
||||
{"type":"LiteralString","value":"'test'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"CommentSingle","value":"// comment"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
24
lexers/testdata/bicep/bicep-directives.actual
vendored
Normal file
24
lexers/testdata/bicep/bicep-directives.actual
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
var vmProperties = {
|
||||
diagnosticsProfile: {
|
||||
bootDiagnostics: {
|
||||
enabled: 123
|
||||
storageUri: true
|
||||
unknownProp: 'asdf'
|
||||
}
|
||||
}
|
||||
evictionPolicy: 'Deallocate'
|
||||
}
|
||||
resource vm 'Microsoft.Compute/virtualMachines@2020-12-01' = {
|
||||
name: 'vm'
|
||||
location: 'West US'
|
||||
#disable-next-line BCP036 BCP037
|
||||
properties: vmProperties
|
||||
}
|
||||
#disable-next-line no-unused-params
|
||||
param storageAccount1 string = 'testStorageAccount'
|
||||
#disable-next-line no-unused-params
|
||||
param storageAccount2 string = 'testStorageAccount'
|
||||
#disable-next-line no-unused-params /* Test comment 1 */
|
||||
param storageAccount3 string = 'testStorageAccount'
|
||||
#disable-next-line no-unused-params // Test comment 2
|
||||
param storageAccount5 string = 'testStorageAccount'
|
154
lexers/testdata/bicep/bicep-directives.expected
vendored
Normal file
154
lexers/testdata/bicep/bicep-directives.expected
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"vmProperties"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"diagnosticsProfile"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"bootDiagnostics"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"enabled"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"123"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"storageUri"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"unknownProp"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'asdf'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"evictionPolicy"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Deallocate'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"vm"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Compute/virtualMachines@2020-12-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'vm'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'West US'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"#disable-next-line"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"BCP036"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"BCP037"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"vmProperties"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"#disable-next-line"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"no"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"unused"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"params"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAccount1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'testStorageAccount'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"#disable-next-line"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"no"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"unused"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"params"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAccount2"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'testStorageAccount'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"#disable-next-line"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"no"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"unused"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"params"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentMultiline","value":"/* Test comment 1 */"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAccount3"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'testStorageAccount'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"CommentPreproc","value":"#disable-next-line"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"no"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"unused"},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"params"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"// Test comment 2"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAccount5"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'testStorageAccount'"}
|
||||
]
|
3
lexers/testdata/bicep/bicep-function-any.actual
vendored
Normal file
3
lexers/testdata/bicep/bicep-function-any.actual
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
publicIPAddress: any((pipId == '') ? null : {
|
||||
id: pipId
|
||||
})
|
28
lexers/testdata/bicep/bicep-function-any.expected
vendored
Normal file
28
lexers/testdata/bicep/bicep-function-any.expected
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
[
|
||||
{"type":"NameVariable","value":"publicIPAddress"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"any"},
|
||||
{"type":"Punctuation","value":"(("},
|
||||
{"type":"NameVariable","value":"pipId"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"?"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"null"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"id"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"pipId"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"})"}
|
||||
]
|
1
lexers/testdata/bicep/bicep-function-deployment.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-function-deployment.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
output deploymentOutput object = deployment()
|
12
lexers/testdata/bicep/bicep-function-deployment.expected
vendored
Normal file
12
lexers/testdata/bicep/bicep-function-deployment.expected
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"deploymentOutput"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"deployment"},
|
||||
{"type":"Punctuation","value":"()"}
|
||||
]
|
4
lexers/testdata/bicep/bicep-function-logical.actual
vendored
Normal file
4
lexers/testdata/bicep/bicep-function-logical.actual
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
output trueString bool = bool('true')
|
||||
output falseString bool = bool('false')
|
||||
output trueInt bool = bool(1)
|
||||
output falseInt bool = bool(0)
|
53
lexers/testdata/bicep/bicep-function-logical.expected
vendored
Normal file
53
lexers/testdata/bicep/bicep-function-logical.expected
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"trueString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'true'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"falseString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'false'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"trueInt"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"falseInt"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":")"}
|
||||
]
|
66
lexers/testdata/bicep/bicep-lambdas.actual
vendored
Normal file
66
lexers/testdata/bicep/bicep-lambdas.actual
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
var doggos = [
|
||||
'Evie'
|
||||
'Casper'
|
||||
'Indy'
|
||||
'Kira'
|
||||
]
|
||||
|
||||
var numbers = range(0, 4)
|
||||
|
||||
var sayHello = map(doggos, i => 'Hello ${i}!')
|
||||
|
||||
var isEven = filter(numbers, i => 0 == i % 2)
|
||||
|
||||
var evenDoggosNestedLambdas = map(filter(numbers, i => contains(filter(numbers, j => 0 == j % 2), i)), x => doggos[x])
|
||||
|
||||
var flattenedArrayOfArrays = flatten([[0, 1], [2, 3], [4, 5]])
|
||||
var flattenedEmptyArray = flatten([])
|
||||
|
||||
var mapSayHi = map(['abc', 'def', 'ghi'], foo => 'Hi ${foo}!')
|
||||
var mapEmpty = map([], foo => 'Hi ${foo}!')
|
||||
var mapObject = map(range(0, length(doggos)), i => {
|
||||
i: i
|
||||
doggo: doggos[i]
|
||||
greeting: 'Ahoy, ${doggos[i]}!'
|
||||
})
|
||||
var mapArray = flatten(map(range(1, 3), i => [i * 2, (i * 2) + 1]))
|
||||
var mapMultiLineArray = flatten(map(range(1, 3), i => [
|
||||
i * 3
|
||||
(i * 3) + 1
|
||||
(i * 3) + 2
|
||||
]))
|
||||
|
||||
var filterEqualityCheck = filter(['abc', 'def', 'ghi'], foo => 'def' == foo)
|
||||
var filterEmpty = filter([], foo => 'def' == foo)
|
||||
|
||||
var sortNumeric = sort([8, 3, 10, -13, 5], (x, y) => x < y)
|
||||
var sortAlpha = sort(['ghi', 'abc', 'def'], (x, y) => x < y)
|
||||
var sortAlphaReverse = sort(['ghi', 'abc', 'def'], (x, y) => x > y)
|
||||
var sortByObjectKey = sort([
|
||||
{ key: 124, name: 'Second' }
|
||||
{ key: 298, name: 'Third' }
|
||||
{ key: 24, name: 'First' }
|
||||
{ key: 1232, name: 'Fourth' }
|
||||
], (x, y) => int(x.key) < int(y.key))
|
||||
var sortEmpty = sort([], (x, y) => int(x) < int(y))
|
||||
|
||||
var reduceStringConcat = reduce(['abc', 'def', 'ghi'], '', (cur, next) => concat(cur, next))
|
||||
var reduceFactorial = reduce(range(1, 5), 1, (cur, next) => cur * next)
|
||||
var reduceObjectUnion = reduce([
|
||||
{ foo: 123 }
|
||||
{ bar: 456 }
|
||||
{ baz: 789 }
|
||||
], {}, (cur, next) => union(cur, next))
|
||||
var reduceEmpty = reduce([], 0, (cur, next) => cur)
|
||||
|
||||
var itemForLoop = [for item in range(0, 10): item]
|
||||
var filteredLoop = filter(itemForLoop, i => i > 5)
|
||||
|
||||
output doggoGreetings array = [for item in mapObject: item.greeting]
|
||||
|
||||
resource storageAcc 'Microsoft.Storage/storageAccounts@2021-09-01' existing = {
|
||||
name: 'asdfsadf'
|
||||
}
|
||||
var mappedResProps = map(items(storageAcc.properties.secondaryEndpoints), item => item.value)
|
||||
|
||||
var parentheses = map([123], (i => '${i}'))
|
937
lexers/testdata/bicep/bicep-lambdas.expected
vendored
Normal file
937
lexers/testdata/bicep/bicep-lambdas.expected
vendored
Normal file
|
@ -0,0 +1,937 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'Evie'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'Casper'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'Indy'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'Kira'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"numbers"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"4"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sayHello"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Hello "},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"!'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"isEven"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"numbers"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"%"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"evenDoggosNestedLambdas"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"numbers"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"contains"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"numbers"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"j"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"j"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"%"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":")),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":"])"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"flattenedArrayOfArrays"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"flatten"},
|
||||
{"type":"Punctuation","value":"([["},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"4"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"5"},
|
||||
{"type":"Punctuation","value":"]])"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"flattenedEmptyArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"flatten"},
|
||||
{"type":"Punctuation","value":"([])"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapSayHi"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Hi "},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"!'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapEmpty"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"([],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Hi "},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"!'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapObject"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"length"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"Punctuation","value":")),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"doggo"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"greeting"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Ahoy, "},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"doggos"},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"!'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"})"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"flatten"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":"]))"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapMultiLineArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"flatten"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"2"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"]))"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"filterEqualityCheck"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"filterEmpty"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"([],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sortNumeric"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"sort"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"NameVariable","value":"8"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"10"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"-"},
|
||||
{"type":"NameVariable","value":"13"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"5"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sortAlpha"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"sort"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sortAlphaReverse"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"sort"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sortByObjectKey"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"sort"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"124"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Second'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"298"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Third'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"24"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'First'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"1232"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Fourth'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"int"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"int"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"key"},
|
||||
{"type":"Punctuation","value":"))"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sortEmpty"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"sort"},
|
||||
{"type":"Punctuation","value":"([],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"int"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"x"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003c"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"int"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"y"},
|
||||
{"type":"Punctuation","value":"))"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"reduceStringConcat"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"reduce"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":"))"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"reduceFactorial"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"reduce"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"5"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"1"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"*"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"reduceObjectUnion"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"reduce"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"123"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"bar"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"456"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"baz"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"789"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{},"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"union"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":"))"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"reduceEmpty"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"reduce"},
|
||||
{"type":"Punctuation","value":"([],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"next"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"cur"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"itemForLoop"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"KeywordDeclaration","value":"for"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"range"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"0"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"10"},
|
||||
{"type":"Punctuation","value":"):"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"filteredLoop"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"filter"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"itemForLoop"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"5"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"doggoGreetings"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"array"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"KeywordDeclaration","value":"for"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mapObject"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"greeting"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAcc"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2021-09-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"existing"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'asdfsadf'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mappedResProps"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"items"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"storageAcc"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"secondaryEndpoints"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"item"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"value"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"parentheses"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"map"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"NameVariable","value":"123"},
|
||||
{"type":"Punctuation","value":"],"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"=\u003e"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'"},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"i"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"'"},
|
||||
{"type":"Punctuation","value":"))"}
|
||||
]
|
30
lexers/testdata/bicep/bicep-module.actual
vendored
Normal file
30
lexers/testdata/bicep/bicep-module.actual
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
@minLength(3)
|
||||
@maxLength(11)
|
||||
param storagePrefix string
|
||||
|
||||
param storageSKU string = 'Standard_LRS'
|
||||
param location string = resourceGroup().location
|
||||
|
||||
var uniqueStorageName = '${storagePrefix}${uniqueString(resourceGroup().id)}'
|
||||
|
||||
resource stg 'Microsoft.Storage/storageAccounts@2019-04-01' = {
|
||||
name: uniqueStorageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
module webModule './webApp.bicep' = {
|
||||
'name': 'webDeploy'
|
||||
'params': {
|
||||
'skuName': 'S1'
|
||||
'location': location
|
||||
}
|
||||
}
|
||||
|
||||
output storageEndpoint object = stg.properties.primaryEndpoints
|
159
lexers/testdata/bicep/bicep-module.expected
vendored
Normal file
159
lexers/testdata/bicep/bicep-module.expected
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameFunction","value":"minLength"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameFunction","value":"maxLength"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"11"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storagePrefix"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Standard_LRS'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"resourceGroup"},
|
||||
{"type":"Punctuation","value":"()."},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'"},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"storagePrefix"},
|
||||
{"type":"LiteralStringInterpol","value":"}${"},
|
||||
{"type":"NameFunction","value":"uniqueString"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"resourceGroup"},
|
||||
{"type":"Punctuation","value":"()."},
|
||||
{"type":"NameVariable","value":"id"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"stg"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-04-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"module"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"webModule"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'./webApp.bicep'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'name'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'webDeploy'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'params'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'skuName'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'S1'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'location'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageEndpoint"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"stg"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"primaryEndpoints"}
|
||||
]
|
65
lexers/testdata/bicep/bicep-newlinesensitivity.actual
vendored
Normal file
65
lexers/testdata/bicep/bicep-newlinesensitivity.actual
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
@allowed(['abc', 'def', 'ghi'])
|
||||
param foo string
|
||||
|
||||
var singleLineFunction = concat('abc', 'def')
|
||||
|
||||
var multiLineFunction = concat(
|
||||
'abc',
|
||||
'def'
|
||||
)
|
||||
|
||||
var multiLineFunctionUnusualFormatting = concat(
|
||||
'abc', any(['hello']),
|
||||
'def')
|
||||
|
||||
var nestedTest = concat(
|
||||
concat(
|
||||
concat(
|
||||
concat(
|
||||
concat(
|
||||
'level',
|
||||
'one'),
|
||||
'two'),
|
||||
'three'),
|
||||
'four'),
|
||||
'five')
|
||||
|
||||
var singleLineArray = ['abc', 'def']
|
||||
var singleLineArrayTrailingCommas = ['abc', 'def',]
|
||||
|
||||
var multiLineArray = [
|
||||
'abc'
|
||||
'def'
|
||||
]
|
||||
|
||||
var mixedArray = ['abc', 'def'
|
||||
'ghi', 'jkl'
|
||||
'lmn']
|
||||
|
||||
var singleLineObject = { abc: 'def', ghi: 'jkl'}
|
||||
var singleLineObjectTrailingCommas = { abc: 'def', ghi: 'jkl',}
|
||||
var multiLineObject = {
|
||||
abc: 'def'
|
||||
ghi: 'jkl'
|
||||
}
|
||||
var mixedObject = { abc: 'abc', def: 'def'
|
||||
ghi: 'ghi', jkl: 'jkl'
|
||||
lmn: 'lmn' }
|
||||
|
||||
var nestedMixed = {
|
||||
abc: { 'def': 'ghi', abc: 'def', foo: [
|
||||
'bar', 'blah'
|
||||
] }
|
||||
}
|
||||
|
||||
var brokenFormatting = [ /*foo */ 'bar' /*
|
||||
|
||||
hello
|
||||
|
||||
*/, 'asdfdsf', 12324, /* asdf*/ '', '''
|
||||
|
||||
|
||||
'''
|
||||
123, 233535
|
||||
true
|
||||
]
|
348
lexers/testdata/bicep/bicep-newlinesensitivity.expected
vendored
Normal file
348
lexers/testdata/bicep/bicep-newlinesensitivity.expected
vendored
Normal file
|
@ -0,0 +1,348 @@
|
|||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameFunction","value":"allowed"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":"])"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"singleLineFunction"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"multiLineFunction"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"multiLineFunctionUnusualFormatting"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"any"},
|
||||
{"type":"Punctuation","value":"(["},
|
||||
{"type":"LiteralString","value":"'hello'"},
|
||||
{"type":"Punctuation","value":"]),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"nestedTest"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"concat"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'level'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'one'"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'two'"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'three'"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'four'"},
|
||||
{"type":"Punctuation","value":"),"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'five'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"singleLineArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"singleLineArrayTrailingCommas"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":",]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"multiLineArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mixedArray"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'jkl'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"'lmn'"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"singleLineObject"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"ghi"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'jkl'"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"singleLineObjectTrailingCommas"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"ghi"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'jkl'"},
|
||||
{"type":"Punctuation","value":",}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"multiLineObject"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"ghi"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'jkl'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"mixedObject"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'abc'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"def"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameVariable","value":"ghi"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"jkl"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'jkl'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameVariable","value":"lmn"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'lmn'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"nestedMixed"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'ghi'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"abc"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'def'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"foo"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"LiteralString","value":"'bar'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'blah'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"brokenFormatting"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentMultiline","value":"/*foo */"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'bar'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"/*"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"NameVariable","value":"hello"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Operator","value":"*/"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'asdfdsf'"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"12324"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentMultiline","value":"/* asdf*/"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'''\n\n\n'''"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameVariable","value":"123"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"233535"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"TextWhitespace","value":"\n"}
|
||||
]
|
1
lexers/testdata/bicep/bicep-output.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-output.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
output storageEndpoint object = stg.properties.primaryEndpoints
|
15
lexers/testdata/bicep/bicep-output.expected
vendored
Normal file
15
lexers/testdata/bicep/bicep-output.expected
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageEndpoint"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"stg"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameVariable","value":"primaryEndpoints"}
|
||||
]
|
4
lexers/testdata/bicep/bicep-parameter-decoration.actual
vendored
Normal file
4
lexers/testdata/bicep/bicep-parameter-decoration.actual
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
@description('The name of the instance.')
|
||||
param name string
|
||||
@sys.description('The description of the instance to display.')
|
||||
param description string
|
27
lexers/testdata/bicep/bicep-parameter-decoration.expected
vendored
Normal file
27
lexers/testdata/bicep/bicep-parameter-decoration.expected
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameFunction","value":"description"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'The name of the instance.'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameVariable","value":"sys"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"description"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'The description of the instance to display.'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"description"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"}
|
||||
]
|
11
lexers/testdata/bicep/bicep-resource-conditional.actual
vendored
Normal file
11
lexers/testdata/bicep/bicep-resource-conditional.actual
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = if (newOrExisting == 'new') {
|
||||
name: uniqueStorageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}
|
62
lexers/testdata/bicep/bicep-resource-conditional.expected
vendored
Normal file
62
lexers/testdata/bicep/bicep-resource-conditional.expected
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sa"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"if"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"newOrExisting"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'new'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
12
lexers/testdata/bicep/bicep-resource-multiple.actual
vendored
Normal file
12
lexers/testdata/bicep/bicep-resource-multiple.actual
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
@batchSize(3)
|
||||
resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = [for storageName in storageAccounts: {
|
||||
name: storageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}]
|
68
lexers/testdata/bicep/bicep-resource-multiple.expected
vendored
Normal file
68
lexers/testdata/bicep/bicep-resource-multiple.expected
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameFunction","value":"batchSize"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameVariable","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"sa"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"KeywordDeclaration","value":"for"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageAccounts"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordConstant","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}]"}
|
||||
]
|
6
lexers/testdata/bicep/bicep-string-singleline-multiline.actual
vendored
Normal file
6
lexers/testdata/bicep/bicep-string-singleline-multiline.actual
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
param exampleString string = 'test value'
|
||||
|
||||
var comments = '''
|
||||
comments // are included
|
||||
/* because everything is read as-is */
|
||||
'''
|
19
lexers/testdata/bicep/bicep-string-singleline-multiline.expected
vendored
Normal file
19
lexers/testdata/bicep/bicep-string-singleline-multiline.expected
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"exampleString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'test value'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"comments"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'''\ncomments // are included\n/* because everything is read as-is */\n'''"}
|
||||
]
|
7
lexers/testdata/bicep/bicep-targetScope.actual
vendored
Normal file
7
lexers/testdata/bicep/bicep-targetScope.actual
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
targetScope = 'resourceGroup'
|
||||
|
||||
targetScope = 'subscription'
|
||||
|
||||
targetScope = 'managementGroup'
|
||||
|
||||
targetScope = 'tenant'
|
25
lexers/testdata/bicep/bicep-targetScope.expected
vendored
Normal file
25
lexers/testdata/bicep/bicep-targetScope.expected
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'resourceGroup'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'subscription'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'managementGroup'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'tenant'"}
|
||||
]
|
7
lexers/testdata/bicep/bicep-types.actual
vendored
Normal file
7
lexers/testdata/bicep/bicep-types.actual
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
type fizz = string
|
||||
|
||||
type buzz = fizz[]
|
||||
|
||||
type pop = {
|
||||
krispies: 'snap'|'crackle'|'pop'
|
||||
}
|
37
lexers/testdata/bicep/bicep-types.expected
vendored
Normal file
37
lexers/testdata/bicep/bicep-types.expected
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"type"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"fizz"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"type"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"buzz"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"fizz"},
|
||||
{"type":"Punctuation","value":"[]"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"type"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"pop"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameVariable","value":"krispies"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'snap'"},
|
||||
{"type":"Punctuation","value":"|"},
|
||||
{"type":"LiteralString","value":"'crackle'"},
|
||||
{"type":"Punctuation","value":"|"},
|
||||
{"type":"LiteralString","value":"'pop'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
2
lexers/testdata/bicep/bicep-variable-string-interpolation.actual
vendored
Normal file
2
lexers/testdata/bicep/bicep-variable-string-interpolation.actual
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
var storagePrefix = 'dev'
|
||||
var uniqueStorageName = '${storagePrefix}${uniqueString(resourceGroup().id)}'
|
28
lexers/testdata/bicep/bicep-variable-string-interpolation.expected
vendored
Normal file
28
lexers/testdata/bicep/bicep-variable-string-interpolation.expected
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"storagePrefix"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'dev'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameVariable","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'"},
|
||||
{"type":"LiteralStringInterpol","value":"${"},
|
||||
{"type":"NameVariable","value":"storagePrefix"},
|
||||
{"type":"LiteralStringInterpol","value":"}${"},
|
||||
{"type":"NameFunction","value":"uniqueString"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"resourceGroup"},
|
||||
{"type":"Punctuation","value":"()."},
|
||||
{"type":"NameVariable","value":"id"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"LiteralStringInterpol","value":"}"},
|
||||
{"type":"LiteralString","value":"'"}
|
||||
]
|
31
lexers/testdata/bqn.actual
vendored
Normal file
31
lexers/testdata/bqn.actual
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! /usr/bin/env bqn
|
||||
|
||||
# From BQN documentation / quick start:
|
||||
# https://mlochbaum.github.io/BQN/doc/quick.html
|
||||
|
||||
# Case conversion utilities
|
||||
case ← {
|
||||
diff ← -´ "Aa"
|
||||
Lower ⇐ -⟜diff
|
||||
Upper ⇐ Lower⁼
|
||||
}
|
||||
|
||||
hw ← <˘ 2‿∘ ⥊ "helloworld"
|
||||
hw case.Upper⌾(⊑¨)↩
|
||||
•Out hw ↩ ∾ ⥊⍉ [hw, ", "‿"!"] # Hello, World!
|
||||
|
||||
# Split at spaces and repeated characters
|
||||
Split ← {
|
||||
!1==𝕩 ⋄ (!2=•Type)¨𝕩
|
||||
Proc ← {
|
||||
· 𝕊 ' ': spl⇐1 ; # Space: break and delete it
|
||||
prev Fn cur: ⟨spl,str⟩⇐
|
||||
spl←0 ⋄ str←⟨cur⟩ # Include and don't break...
|
||||
{ prev=cur ? spl+↩1 ; @ } # except at equal characters
|
||||
}
|
||||
GV‿GS ← {𝕏¨}¨ ⟨ {⟨s⇐str⟩:s;""}
|
||||
{𝕩.spl} ⟩
|
||||
r ← Proc{»𝔽¨⊢} 𝕩
|
||||
(∾¨ GV ⊔˜ ·+`GS) r
|
||||
}
|
||||
•Show Split hw # ⟨ "Hel" "lo," "World!" ⟩
|
258
lexers/testdata/bqn.expected
vendored
Normal file
258
lexers/testdata/bqn.expected
vendored
Normal file
|
@ -0,0 +1,258 @@
|
|||
[
|
||||
{"type":"CommentPreproc","value":"#! /usr/bin/env bqn"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# From BQN documentation / quick start:"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentSingle","value":"# https://mlochbaum.github.io/BQN/doc/quick.html"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# Case conversion utilities"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Name","value":"case"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Name","value":"diff"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"-"},
|
||||
{"type":"Operator","value":"´"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\"Aa\""},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameFunction","value":"Lower"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"⇐"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"-"},
|
||||
{"type":"OperatorWord","value":"⟜"},
|
||||
{"type":"Name","value":"diff"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameFunction","value":"Upper"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"⇐"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"Lower"},
|
||||
{"type":"Operator","value":"⁼"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Name","value":"hw"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"\u003c"},
|
||||
{"type":"Operator","value":"˘"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralNumber","value":"2"},
|
||||
{"type":"KeywordPseudo","value":"‿"},
|
||||
{"type":"OperatorWord","value":"∘"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"⥊"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\"helloworld\""},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Name","value":"hw"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"case"},
|
||||
{"type":"Text","value":"."},
|
||||
{"type":"NameFunction","value":"Upper"},
|
||||
{"type":"OperatorWord","value":"⌾"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"⊑"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":"↩"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"•Out"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"hw"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"↩"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"∾"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"⥊⍉"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"["},
|
||||
{"type":"Name","value":"hw"},
|
||||
{"type":"KeywordPseudo","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\", \""},
|
||||
{"type":"KeywordPseudo","value":"‿"},
|
||||
{"type":"LiteralString","value":"\"!\""},
|
||||
{"type":"KeywordPseudo","value":"]"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"# Hello, World!"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# Split at spaces and repeated characters"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"Split"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameFunction","value":"!"},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"NameFunction","value":"=="},
|
||||
{"type":"Name","value":"𝕩"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"⋄"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"!"},
|
||||
{"type":"LiteralNumber","value":"2"},
|
||||
{"type":"NameFunction","value":"=•Type"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"Name","value":"𝕩"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameFunction","value":"Proc"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameConstant","value":"·"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"𝕊"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringChar","value":"' '"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"spl"},
|
||||
{"type":"Text","value":"⇐"},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"# Space: break and delete it"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Name","value":"prev"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"Fn"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"cur"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"⟨"},
|
||||
{"type":"Name","value":"spl"},
|
||||
{"type":"KeywordPseudo","value":","},
|
||||
{"type":"Name","value":"str"},
|
||||
{"type":"KeywordPseudo","value":"⟩"},
|
||||
{"type":"Text","value":"⇐"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Name","value":"spl"},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"LiteralNumber","value":"0"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"⋄"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"str"},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"KeywordPseudo","value":"⟨"},
|
||||
{"type":"Name","value":"cur"},
|
||||
{"type":"KeywordPseudo","value":"⟩"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"# Include and don't break..."},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"prev"},
|
||||
{"type":"NameFunction","value":"="},
|
||||
{"type":"Name","value":"cur"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"?"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"spl"},
|
||||
{"type":"NameFunction","value":"+"},
|
||||
{"type":"Text","value":"↩"},
|
||||
{"type":"LiteralNumber","value":"1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringChar","value":"@"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"# except at equal characters"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameFunction","value":"GV"},
|
||||
{"type":"KeywordPseudo","value":"‿"},
|
||||
{"type":"NameFunction","value":"GS"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"NameFunction","value":"𝕏"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"⟨"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"{⟨"},
|
||||
{"type":"Name","value":"s"},
|
||||
{"type":"Text","value":"⇐"},
|
||||
{"type":"Name","value":"str"},
|
||||
{"type":"KeywordPseudo","value":"⟩"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"Name","value":"s"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"LiteralString","value":"\"\""},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"Name","value":"𝕩"},
|
||||
{"type":"Text","value":"."},
|
||||
{"type":"Name","value":"spl"},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordPseudo","value":"⟩"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Name","value":"r"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"←"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"Proc"},
|
||||
{"type":"KeywordPseudo","value":"{"},
|
||||
{"type":"NameFunction","value":"»𝔽"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"NameFunction","value":"⊢"},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"𝕩"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameFunction","value":"∾"},
|
||||
{"type":"Operator","value":"¨"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"GV"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"⊔"},
|
||||
{"type":"Operator","value":"˜"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameConstant","value":"·"},
|
||||
{"type":"NameFunction","value":"+"},
|
||||
{"type":"Operator","value":"`"},
|
||||
{"type":"NameFunction","value":"GS"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"r"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordPseudo","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameFunction","value":"•Show"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"Split"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Name","value":"hw"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"# ⟨ \"Hel\" \"lo,\" \"World!\" ⟩"},
|
||||
{"type":"TextWhitespace","value":"\n"}
|
||||
]
|
142
lexers/testdata/caddyfile.actual
vendored
Normal file
142
lexers/testdata/caddyfile.actual
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
debug
|
||||
admin off
|
||||
on_demand_tls {
|
||||
ask https://example.com
|
||||
}
|
||||
log default {
|
||||
output file /var/log/caddy/access.log
|
||||
format json
|
||||
}
|
||||
auto_https disable_redirects
|
||||
renew_interval 20m
|
||||
|
||||
# this is a comment
|
||||
servers 192.168.1.2:8080 {
|
||||
name public
|
||||
trusted_proxies static private_ranges
|
||||
log_credentials
|
||||
}
|
||||
}
|
||||
|
||||
# top level comment
|
||||
|
||||
(blocking) {
|
||||
@blocked {
|
||||
path *.txt *.md *.mdown /site/*
|
||||
}
|
||||
redir @blocked /
|
||||
}
|
||||
|
||||
http://example.com {
|
||||
respond "http"
|
||||
}
|
||||
|
||||
example.com, fake.org, {$ENV_SITE} {
|
||||
root * /srv
|
||||
|
||||
respond /get-env {$ENV_VAR}
|
||||
respond /get-env {$ENV_VAR:default}
|
||||
|
||||
tls internal
|
||||
tls /path/to/cert.pem /path/to/key.pem
|
||||
|
||||
route {
|
||||
# Add trailing slash for directory requests
|
||||
@canonicalPath {
|
||||
file {
|
||||
try_files {path}/index.php
|
||||
}
|
||||
not path */
|
||||
}
|
||||
redir @canonicalPath {path}/ 308
|
||||
|
||||
# If the requested file does not exist, try index files
|
||||
@indexFiles {
|
||||
file {
|
||||
try_files {path} {path}/index.php index.php
|
||||
split_path .php
|
||||
}
|
||||
}
|
||||
rewrite @indexFiles {http.matchers.file.relative}
|
||||
|
||||
# Proxy PHP files to the FastCGI responder
|
||||
@phpFiles {
|
||||
path *.php
|
||||
}
|
||||
reverse_proxy @phpFiles unix//var/run/php7.4-fpm.sock {
|
||||
transport fastcgi {
|
||||
split .php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@encode_exts {
|
||||
path / *.html *.js *.css *.svg
|
||||
}
|
||||
|
||||
header {
|
||||
X-Content-Type-Options nosniff
|
||||
X-XSS-Protection "1; mode=block"
|
||||
X-Robots-Tag none
|
||||
Content-Security-Policy "frame-ancestors 'self'"
|
||||
X-Frame-Options DENY
|
||||
Referrer-Policy same-origin
|
||||
}
|
||||
|
||||
@singleLine not path /matcher
|
||||
respond @singleLine "Awesome."
|
||||
|
||||
import blocking
|
||||
import blocking foo
|
||||
import glob/*
|
||||
|
||||
file_server
|
||||
|
||||
@named host example.com
|
||||
handle @named {
|
||||
handle /foo* {
|
||||
handle /foo* {
|
||||
respond "{path} foo"
|
||||
}
|
||||
}
|
||||
respond "foo"
|
||||
}
|
||||
|
||||
handle_path /foo* {
|
||||
respond "foo"
|
||||
}
|
||||
|
||||
reverse_proxy /api/* unix//var/run/api.sock {
|
||||
@good status 200
|
||||
handle_response @good {
|
||||
rewrite * /foo{uri}
|
||||
file_server
|
||||
}
|
||||
}
|
||||
|
||||
respond <<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello, world!</h1>
|
||||
</body>
|
||||
</html>
|
||||
HTML 200
|
||||
|
||||
@file `file()`
|
||||
@first `file({'try_files': [{path}, {path} + '/', 'index.html']})`
|
||||
@smallest `file({'try_policy': 'smallest_size', 'try_files': ['a.txt', 'b.txt']})`
|
||||
|
||||
@without-both {
|
||||
not {
|
||||
path /api/*
|
||||
method POST
|
||||
}
|
||||
}
|
||||
|
||||
path_regexp [<name>] <regexp>
|
||||
}
|
465
lexers/testdata/caddyfile.expected
vendored
Normal file
465
lexers/testdata/caddyfile.expected
vendored
Normal file
|
@ -0,0 +1,465 @@
|
|||
[
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"debug"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"admin"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameConstant","value":"off"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"on_demand_tls"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"ask"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"https://example.com"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"log"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"default"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"output"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"file"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/var/log/caddy/access.log"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"format"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"json"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"auto_https"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameConstant","value":"disable_redirects"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"renew_interval"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"20m"},
|
||||
{"type":"CommentSingle","value":"\n\n\t# this is a comment\n"},
|
||||
{"type":"Text","value":"\t"},
|
||||
{"type":"Keyword","value":"servers"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"192.168.1.2"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"LiteralNumberInteger","value":"8080"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"name"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"public"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"trusted_proxies"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"static"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameConstant","value":"private_ranges"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"log_credentials"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"CommentSingle","value":"\n\n# top level comment\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameVariableAnonymous","value":"(blocking)"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"NameDecorator","value":"@blocked"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.txt"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.md"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.mdown"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/site/*"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"redir"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@blocked"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"GenericHeading","value":"http://example.com"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"http\""},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"GenericHeading","value":"example.com"},
|
||||
{"type":"Text","value":", "},
|
||||
{"type":"GenericHeading","value":"fake.org"},
|
||||
{"type":"Text","value":", "},
|
||||
{"type":"LiteralStringEscape","value":"{$ENV_SITE}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"root"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/srv"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/get-env"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{$ENV_VAR}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/get-env"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{$ENV_VAR:default}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"tls"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameConstant","value":"internal"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"tls"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/path/to/cert.pem"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/path/to/key.pem"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"route"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"CommentSingle","value":"\n\t\t# Add trailing slash for directory requests\n"},
|
||||
{"type":"Text","value":"\t\t"},
|
||||
{"type":"NameDecorator","value":"@canonicalPath"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"file"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t\t"},
|
||||
{"type":"Keyword","value":"try_files"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralString","value":"/index.php"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"not"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*/"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"redir"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@canonicalPath"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralString","value":"/"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"308"},
|
||||
{"type":"CommentSingle","value":"\n\n\t\t# If the requested file does not exist, try index files\n"},
|
||||
{"type":"Text","value":"\t\t"},
|
||||
{"type":"NameDecorator","value":"@indexFiles"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"file"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t\t"},
|
||||
{"type":"Keyword","value":"try_files"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralString","value":"/index.php"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"index.php"},
|
||||
{"type":"Text","value":"\n\t\t\t\t"},
|
||||
{"type":"Keyword","value":"split_path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":".php"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"rewrite"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@indexFiles"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringEscape","value":"{http.matchers.file.relative}"},
|
||||
{"type":"CommentSingle","value":"\n\n\t\t# Proxy PHP files to the FastCGI responder\n"},
|
||||
{"type":"Text","value":"\t\t"},
|
||||
{"type":"NameDecorator","value":"@phpFiles"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.php"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"reverse_proxy"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@phpFiles"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"unix//var/run/php7.4-fpm.sock"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"transport"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"fastcgi"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t\t"},
|
||||
{"type":"Keyword","value":"split"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":".php"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"NameDecorator","value":"@encode_exts"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.html"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.js"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.css"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"*.svg"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"header"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"X-Content-Type-Options"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"nosniff"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"X-XSS-Protection"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"1; mode=block\""},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"X-Robots-Tag"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"none"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"Content-Security-Policy"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"frame-ancestors 'self'\""},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"X-Frame-Options"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"DENY"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"Referrer-Policy"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"same-origin"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"NameDecorator","value":"@singleLine"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"not"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/matcher"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@singleLine"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"Awesome.\""},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"import"},
|
||||
{"type":"Text","value":" blocking\n\t"},
|
||||
{"type":"Keyword","value":"import"},
|
||||
{"type":"Text","value":" blocking "},
|
||||
{"type":"LiteralString","value":"foo"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"import"},
|
||||
{"type":"Text","value":" glob/*\n\n\t"},
|
||||
{"type":"Keyword","value":"file_server"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"NameDecorator","value":"@named"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"host"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"example.com"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Keyword","value":"handle"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@named"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"handle"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/foo*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"handle"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/foo*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\""},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralStringDouble","value":" foo\""},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"foo\""},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"handle_path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/foo*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringDouble","value":"\"foo\""},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"reverse_proxy"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"/api/*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"unix//var/run/api.sock"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"NameDecorator","value":"@good"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"status"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"200"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"handle_response"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"@good"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"rewrite"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameDecorator","value":"*"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/foo"},
|
||||
{"type":"LiteralStringEscape","value":"{uri}"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"file_server"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"respond"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringHeredoc","value":"\u003c\u003cHTML"},
|
||||
{"type":"LiteralString","value":"\n\t\t\u003c!DOCTYPE html\u003e\n\t\t\u003chtml\u003e\n\t\t\t\u003chead\u003e\n\t\t\t\t\u003ctitle\u003eTest\u003c/title\u003e\n\t\t\t\u003c/head\u003e\n\t\t\t\u003cbody\u003e\n\t\t\t\t\u003ch1\u003eHello, world!\u003c/h1\u003e\n\t\t\t\u003c/body\u003e\n\t\t\u003c/html\u003e\n\t\t"},
|
||||
{"type":"LiteralStringHeredoc","value":"HTML"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"200"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"NameDecorator","value":"@file"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringBacktick","value":"`file()`"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"NameDecorator","value":"@first"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringBacktick","value":"`file("},
|
||||
{"type":"LiteralString","value":"{'try_files"},
|
||||
{"type":"LiteralStringBacktick","value":"': ["},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralStringBacktick","value":", "},
|
||||
{"type":"LiteralStringEscape","value":"{path}"},
|
||||
{"type":"LiteralStringBacktick","value":" + '/', 'index.html']})`"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"NameDecorator","value":"@smallest"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralStringBacktick","value":"`file("},
|
||||
{"type":"LiteralString","value":"{'try_policy"},
|
||||
{"type":"LiteralStringBacktick","value":"': 'smallest_size', 'try_files': ['a.txt', 'b.txt']})`"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"NameDecorator","value":"@without-both"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Keyword","value":"not"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"/api/*"},
|
||||
{"type":"Text","value":"\n\t\t\t"},
|
||||
{"type":"Keyword","value":"method"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"POST"},
|
||||
{"type":"Text","value":"\n\t\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\t"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n\n\t"},
|
||||
{"type":"Keyword","value":"path_regexp"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"LiteralString","value":"\u003cname\u003e"},
|
||||
{"type":"Punctuation","value":"]"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\u003cregexp\u003e"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
27
lexers/testdata/cfengine3.actual
vendored
Normal file
27
lexers/testdata/cfengine3.actual
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
@if minimum_version(3.20)
|
||||
body members foo
|
||||
{
|
||||
include => { "alice", "bob" };
|
||||
exclude => { "malcom" };
|
||||
}
|
||||
@endif
|
||||
|
||||
@if minimum_version(3.20)
|
||||
promise agent blah
|
||||
{
|
||||
path => "/some/path";
|
||||
}
|
||||
@endif
|
||||
|
||||
bundle agent __main__
|
||||
{
|
||||
groups:
|
||||
"foo"
|
||||
policy => "present",
|
||||
@if minimum_version(3.20)
|
||||
members => foo;
|
||||
@else
|
||||
members => '{ "include": ["alice", "bob"],
|
||||
"exclude": ["malcom"] }';
|
||||
@endif
|
||||
}
|
99
lexers/testdata/cfengine3.expected
vendored
Normal file
99
lexers/testdata/cfengine3.expected
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
[
|
||||
{"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"},
|
||||
{"type":"Keyword","value":"body"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"members"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"foo"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"include"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"alice\""},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"bob\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"exclude"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"malcom\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@endif\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"},
|
||||
{"type":"Keyword","value":"promise"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"agent"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"blah"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"path"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"/some/path\""},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@endif\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"bundle"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"agent"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"__main__"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"groups"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"LiteralString","value":"\"foo\""},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordReserved","value":"policy"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"present\""},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"members"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"foo"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@else\n"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordReserved","value":"members"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"=\u003e"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"'{ \"include\": [\"alice\", \"bob\"],\n \"exclude\": [\"malcom\"] }'"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"CommentPreproc","value":"@endif\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
6
lexers/testdata/chapel.actual
vendored
Normal file
6
lexers/testdata/chapel.actual
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
config const numMessages = 100;
|
||||
|
||||
forall msg in 1..numMessages do
|
||||
writeln("Hello, world! (from iteration ", msg, " of ", numMessages, ")");
|
||||
|
||||
// Oh, and a comment for good measure.
|
43
lexers/testdata/chapel.expected
vendored
Normal file
43
lexers/testdata/chapel.expected
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"config"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"const"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameOther","value":"numMessages"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"100"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Keyword","value":"forall"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameOther","value":"msg"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1"},
|
||||
{"type":"Operator","value":".."},
|
||||
{"type":"NameOther","value":"numMessages"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Keyword","value":"do"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameOther","value":"writeln"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"\"Hello, world! (from iteration \""},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameOther","value":"msg"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\" of \""},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameOther","value":"numMessages"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"\")\""},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"// Oh, and a comment for good measure.\n"}
|
||||
]
|
26
lexers/testdata/cpp.actual
vendored
Normal file
26
lexers/testdata/cpp.actual
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "a" // comment
|
||||
#include <b> // comment
|
||||
|
||||
[[nodiscard]] void foo() noexcept;
|
||||
void foo();
|
||||
|
||||
constexpr class {} a;
|
||||
|
||||
enum class E { A, B };
|
||||
enum class [[nodiscard]] E { A, B };
|
||||
|
||||
enum class {
|
||||
a, b,
|
||||
c,
|
||||
} e;
|
||||
|
||||
enum E { A, B };
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
void bar();
|
||||
};
|
||||
|
||||
int main() {
|
||||
return 0 + 1'3 + 1.4;
|
||||
}
|
142
lexers/testdata/cpp.expected
vendored
Normal file
142
lexers/testdata/cpp.expected
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
[
|
||||
{"type":"CommentPreproc","value":"#include"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentPreprocFile","value":"\"a\""},
|
||||
{"type":"CommentPreproc","value":" "},
|
||||
{"type":"CommentSingle","value":"// comment\n"},
|
||||
{"type":"CommentPreproc","value":"#include"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentPreprocFile","value":"\u003cb\u003e"},
|
||||
{"type":"CommentPreproc","value":" "},
|
||||
{"type":"CommentSingle","value":"// comment\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"NameAttribute","value":"[[nodiscard]]"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"foo"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"noexcept"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"foo"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"constexpr"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"class"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"a"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"enum"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"class"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"E"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"A"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"B"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"enum"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"class"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameAttribute","value":"[[nodiscard]]"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"E"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"A"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"B"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"enum"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"class"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"a"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"b"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"c"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"e"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"enum"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"E"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"A"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"B"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"class"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"A"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"foo"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordType","value":"void"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"bar"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"};"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordType","value":"int"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameFunction","value":"main"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"return"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"0"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberInteger","value":"1'3"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralNumberFloat","value":"1.4"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
68
lexers/testdata/cql.actual
vendored
Normal file
68
lexers/testdata/cql.actual
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- basic statements
|
||||
// c-style comment
|
||||
/*
|
||||
|
||||
multiline comment
|
||||
|
||||
*/
|
||||
CREATE TABLE cycling.cyclist_name ( id UUID PRIMARY KEY, lastname text, firstname text );
|
||||
INSERT INTO cycling.cyclist_name (id, lastname, firstname) VALUES (5b6962dd-3f90-4c93-8f61-eabfa4a803e2, 'VOS','Marianne');
|
||||
SELECT * FROM cycling.cyclist_name;
|
||||
SELECT lastname, firstname FROM /* a comment */ cycling.cyclist_name WHERE id = 6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47 /* multiline comment
|
||||
|
||||
*/ -- comment;
|
||||
;
|
||||
|
||||
CREATE TABLE cycling.cyclist_category ( category text, points int, id UUID, lastname text, PRIMARY KEY (category, points)) WITH CLUSTERING ORDER BY (points DESC);
|
||||
CREATE TABLE cycling.race_winners (race_name text, race_position int, cyclist_name FROZEN<fullname>, PRIMARY KEY (race_name, race_position));
|
||||
CREATE TABLE cycling.cyclist_races ( id UUID PRIMARY KEY, lastname text, firstname text, races list<FROZEN <race>> );
|
||||
INSERT INTO cycling.cyclist_races (id, lastname, firstname, races) VALUES (5b6962dd-3f90-4c93-8f61-eabfa4a803e2, 'VOS', 'Marianne', [ {race_title:'Rabobank 7-Dorpenomloop Aalburg',race_date:'2015-05-09',race_time:'02:58:33'},{race_title:'Ronde van Gelderland',race_date:'2015-04-19',race_time:'03:22:23'}
|
||||
]);
|
||||
|
||||
INSERT INTO cycling.cyclist_races (id, lastname, firstname, races) VALUES (e7cd5752-bc0d-4157-a80f-7523add8dbcd, 'VAN DER BREGGEN', 'Anna', [ {race_title:'Festival Luxembourgeois du cyclisme feminin Elsy Jacobs - Prologue - Garnich > Garnich',race_date:'2015-05-01',race_time:'08:13:00'},{race_title:'Festival Luxembourgeois du cyclisme feminin Elsy Jacobs - Stage 2 - Garnich > Garnich',race_date:'2015-05-02',race_time:'02:41:52'},{race_title:'Festival Luxembourgeois du cyclisme feminin Elsy Jacobs - Stage 3 - Mamer > Mamer',race_date:'2015-05-03',race_time:'02:31:24'} ]);
|
||||
|
||||
SELECT * FROM cycling.cyclist_races;
|
||||
|
||||
SELECT lastname, races FROM cycling.cyclist_races WHERE id = e7cd5752-bc0d-4157-a80f-7523add8dbcd;
|
||||
|
||||
INSERT INTO cycling.calendar (race_id, race_start_date, race_end_date, race_name) VALUES (201, '2015-02-18', '2015-02-22', $$Women's Tour of New Zealand$$);
|
||||
|
||||
CREATE USER IF NOT EXISTS sandy WITH PASSWORD 'Ride2Win@' NOSUPERUSER;
|
||||
CREATE USER chuck WITH PASSWORD 'Always1st$' SUPERUSER;
|
||||
ALTER USER sandy SUPERUSER;
|
||||
LIST USERS;
|
||||
DROP USER IF EXISTS chuck;
|
||||
CREATE ROLE IF NOT EXISTS team_manager WITH PASSWORD = 'RockIt4Us!';
|
||||
CREATE ROLE sys_admin WITH PASSWORD = 'IcanDoIt4ll' AND LOGIN = true AND SUPERUSER = true;
|
||||
ALTER ROLE sys_admin WITH PASSWORD = 'All4one1forAll' AND SUPERUSER = false;
|
||||
GRANT sys_admin TO team_manager;
|
||||
GRANT team_manager TO sandy;
|
||||
LIST ROLES;
|
||||
LIST ROLES OF sandy;
|
||||
REVOKE sys_admin FROM team_manager;
|
||||
REVOKE team_manager FROM sandy;
|
||||
DROP ROLE IF EXISTS sys_admin;
|
||||
GRANT MODIFY ON KEYSPACE cycling TO team_manager;
|
||||
GRANT DESCRIBE ON ALL ROLES TO sys_admin;
|
||||
GRANT AUTHORIZE ALL KEYSPACES TO sys_admin;
|
||||
REVOKE SELECT ON ALL KEYSPACES FROM team_manager;
|
||||
REVOKE EXECUTE ON FUNCTION cycling.fLog(double) FROM team_manager;
|
||||
LIST ALL PERMISSIONS OF sandy;
|
||||
LIST ALL PERMISSIONS ON cycling.cyclist_name OF chuck;
|
||||
CREATE MATERIALIZED VIEW cyclist_by_age AS SELECT age, birthday, name, country FROM cyclist_mv WHERE age is NOT NULL AND cid IS NOT NULL PRIMARY KEY (age, cid);
|
||||
CREATE MATERIALIZED VIEW cyclist_by_country AS SELECT age, birthday, name, country FROM cyclist_mv WHERE country is NOT NULL AND cid IS NOT NULL PRIMARY KEY (country, cid);
|
||||
CREATE MATERIALIZED VIEW cyclist_by_birthday AS SELECT age, birthday, name, country FROM cyclist_mv WHERE birthday is NOT NULL AND cid IS NOT NULL PRIMARY KEY (birthday, cid);
|
||||
DROP MATERIALIZED VIEW cyclist_by_age;
|
||||
INSERT INTO cycling.calendar (race_id, race_name, race_start_date, race_end_date) VALUES (200, 'placeholder', '2015-05-27', '2015-05-27') USING TIMESTAMP 123456789;
|
||||
|
||||
CREATE FUNCTION IF NOT EXISTS cycling.left (column TEXT,num int)
|
||||
RETURNS NULL ON NULL INPUT
|
||||
RETURNS text
|
||||
LANGUAGE javascript AS $$
|
||||
column.substring(0,num)
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION cycling.fLog (input double)
|
||||
CALLED ON NULL INPUT
|
||||
RETURNS double LANGUAGE java AS
|
||||
'return Double.valueOf(Math.log(input.doubleValue()));';
|
1085
lexers/testdata/cql.expected
vendored
Normal file
1085
lexers/testdata/cql.expected
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
lexers/testdata/csharp/csharp_8_nullable.actual
vendored
Normal file
10
lexers/testdata/csharp/csharp_8_nullable.actual
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
#nullable enable
|
||||
|
||||
public struct Student
|
||||
{
|
||||
public string FirstName;
|
||||
public string? MiddleName;
|
||||
public string LastName;
|
||||
}
|
41
lexers/testdata/csharp/csharp_8_nullable.expected
vendored
Normal file
41
lexers/testdata/csharp/csharp_8_nullable.expected
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
[
|
||||
{"type":"Keyword","value":"using"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameNamespace","value":"System"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentPreproc","value":"#nullable"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"enable"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"struct"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"Student"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"FirstName"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string?"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"MiddleName"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"LastName"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
1
lexers/testdata/csharp/csharp_9_records_1.actual
vendored
Normal file
1
lexers/testdata/csharp/csharp_9_records_1.actual
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
public record Person(string FirstName, string LastName);
|
17
lexers/testdata/csharp/csharp_9_records_1.expected
vendored
Normal file
17
lexers/testdata/csharp/csharp_9_records_1.expected
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"record"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"Person"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"FirstName"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"LastName"},
|
||||
{"type":"Punctuation","value":");"}
|
||||
]
|
5
lexers/testdata/csharp/csharp_9_records_2.actual
vendored
Normal file
5
lexers/testdata/csharp/csharp_9_records_2.actual
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
public record Person
|
||||
{
|
||||
public string FirstName { get; init; } = default!;
|
||||
public string LastName { get; init; } = default!;
|
||||
};
|
53
lexers/testdata/csharp/csharp_9_records_2.expected
vendored
Normal file
53
lexers/testdata/csharp/csharp_9_records_2.expected
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
[
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"record"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameClass","value":"Person"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"FirstName"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"get"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"init"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"default"},
|
||||
{"type":"Punctuation","value":"!;"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordDeclaration","value":"public"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordType","value":"string"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"LastName"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"get"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"init"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"default"},
|
||||
{"type":"Punctuation","value":"!;"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"};"}
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue