diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index e55c09eb..ad92d00a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1202,6 +1202,16 @@ LFE: LLVM: extensions: - .ll + +LSL: + type: programming + lexer: LSL + ace_mode: lsl + extensions: + - .lsl + interpreters: + - lsl + color: '#3d9970' LabVIEW: type: programming diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index ef1b399e..aa13d4b2 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -254,6 +254,9 @@ ".dlm", ".pro" ], + "IGOR Pro": [ + ".ipf" + ], "Idris": [ ".idr" ], @@ -308,6 +311,9 @@ "LFE": [ ".lfe" ], + "LSL": [ + ".lsl" + ], "Lasso": [ ".las", ".lasso", @@ -845,8 +851,8 @@ "exception.zep.php" ] }, - "tokens_total": 654541, - "languages_total": 900, + "tokens_total": 654836, + "languages_total": 903, "tokens": { "ABAP": { "*/**": 1, @@ -28185,6 +28191,52 @@ "L": 1, "example": 1 }, + "IGOR Pro": { + "#pragma": 2, + "rtGlobals": 2, + "Function": 6, + "FooBar": 1, + "(": 10, + ")": 10, + "return": 7, + "End": 7, + "FooBarSubType": 1, + "ButtonControl": 1, + "Function/D": 1, + "FooBarVar": 1, + "static": 3, + "FooBarStatic": 1, + "threadsafe": 2, + "FooBarStaticThreadsafe": 1, + "FooBarThread": 1, + "CallOperationsAndBuiltInFuncs": 1, + "string": 4, + "var": 3, + "someDQString": 2, + "Make/N": 1, + "myWave": 2, + "Redimension/N": 1, + "-": 3, + "print": 1, + "strlen": 1, + "StrConstant": 1, + "myConstString": 1, + "constant": 1, + "myConst": 1, + "Structure": 2, + "struct1": 1, + "str": 2, + "variable": 2, + "EndStructure": 2, + "struct2": 1, + "#include": 1, + "#ifdef": 1, + "NOT_DEFINED": 1, + "//": 1, + "conditional": 1, + "compilation": 1, + "#endif": 1 + }, "INI": { ";": 1, "editorconfig.org": 1, @@ -35990,6 +36042,72 @@ "info": 1, "reproduce": 1 }, + "LSL": { + "integer": 8, + "someIntNormal": 2, + ";": 29, + "someIntHex": 2, + "someIntMath": 2, + "PI_BY_TWO": 2, + "event": 2, + "//": 5, + "is": 3, + "invalid.illegal": 2, + "key": 3, + "someKeyTexture": 2, + "TEXTURE_DEFAULT": 2, + "string": 5, + "someStringSpecial": 2, + "EOF": 2, + "some_user_defined_function_without_return_type": 2, + "(": 19, + "inputAsString": 2, + ")": 19, + "{": 9, + "llSay": 1, + "PUBLIC_CHANNEL": 4, + "}": 9, + "user_defined_function_returning_a_string": 2, + "inputAsKey": 2, + "return": 1, + "default": 2, + "state_entry": 2, + "someKey": 3, + "NULL_KEY": 1, + "llGetOwner": 1, + "someString": 2, + "touch_start": 1, + "num_detected": 2, + "list": 1, + "agentsInRegion": 3, + "llGetAgentList": 1, + "AGENT_LIST_REGION": 1, + "[": 1, + "]": 1, + "numOfAgents": 2, + "llGetListLength": 1, + "index": 4, + "defaults": 1, + "to": 1, + "for": 2, + "<": 1, + "-": 1, + "+": 2, + "each": 1, + "agent": 1, + "in": 1, + "region": 1, + "llRegionSayTo": 1, + "llList2Key": 1, + "touch_end": 1, + "llSetInventoryPermMask": 1, + "MASK_NEXT": 1, + "PERM_ALL": 1, + "reserved.godmode": 1, + "llWhisper": 2, + "state": 3, + "other": 2 + }, "Lasso": { "<": 7, "LassoScript": 1, @@ -72649,6 +72767,7 @@ "Haskell": 302, "Hy": 155, "IDL": 418, + "IGOR Pro": 97, "INI": 27, "Idris": 148, "Inform 7": 75, @@ -72666,6 +72785,7 @@ "Kit": 6, "Kotlin": 155, "LFE": 1711, + "LSL": 198, "Lasso": 9849, "Latte": 759, "Less": 39, @@ -72862,6 +72982,7 @@ "Haskell": 3, "Hy": 2, "IDL": 4, + "IGOR Pro": 2, "INI": 2, "Idris": 1, "Inform 7": 2, @@ -72879,6 +73000,7 @@ "Kit": 1, "Kotlin": 1, "LFE": 4, + "LSL": 1, "Lasso": 4, "Latte": 2, "Less": 1, @@ -73005,5 +73127,5 @@ "fish": 3, "wisp": 1 }, - "md5": "7a970958bd95602c130be259e8f3fc31" + "md5": "74f6109f5d8edac6b3f2bd3d65b9d210" } \ No newline at end of file diff --git a/samples/LSL/LSL.lsl b/samples/LSL/LSL.lsl new file mode 100644 index 00000000..5d281b95 --- /dev/null +++ b/samples/LSL/LSL.lsl @@ -0,0 +1,74 @@ +/* + Testing syntax highlighting + for the Linden Scripting Language +*/ + +integer someIntNormal = 3672; +integer someIntHex = 0x00000000; +integer someIntMath = PI_BY_TWO; + +integer event = 5673;// 'event' is invalid.illegal + +key someKeyTexture = TEXTURE_DEFAULT; +string someStringSpecial = EOF; + +some_user_defined_function_without_return_type(string inputAsString) +{ + llSay(PUBLIC_CHANNEL, inputAsString); +} + +string user_defined_function_returning_a_string(key inputAsKey) +{ + return (string)inputAsKey; +} + +default +{ + state_entry() + { + key someKey = NULL_KEY; + someKey = llGetOwner(); + + string someString = user_defined_function_returning_a_string(someKey); + + some_user_defined_function_without_return_type(someString); + } + + touch_start(integer num_detected) + { + list agentsInRegion = llGetAgentList(AGENT_LIST_REGION, []); + integer numOfAgents = llGetListLength(agentsInRegion); + + integer index; // defaults to 0 + for (; index <= numOfAgents - 1; index++) // for each agent in region + { + llRegionSayTo(llList2Key(agentsInRegion, index), PUBLIC_CHANNEL, "Hello, Avatar!"); + } + } + + touch_end(integer num_detected) + { + someIntNormal = 3672; + someIntHex = 0x00000000; + someIntMath = PI_BY_TWO; + + event = 5673;// 'event' is invalid.illegal + + someKeyTexture = TEXTURE_DEFAULT; + someStringSpecial = EOF; + + llSetInventoryPermMask("some item", MASK_NEXT, PERM_ALL);// 'llSetInventoryPermMask' is reserved.godmode + + llWhisper(PUBLIC_CHANNEL, "Leaving \"default\" now..."); + state other; + } +} + +state other +{ + state_entry() + { + llWhisper(PUBLIC_CHANNEL, "Entered \"state other\", returning to \"default\" again..."); + state default; + } +} diff --git a/test/test_language.rb b/test/test_language.rb index 3bd41c65..f2bbfc8b 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -33,6 +33,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal Lexer['Java'], Language['ChucK'].lexer assert_equal Lexer['Java'], Language['Java'].lexer assert_equal Lexer['JavaScript'], Language['JavaScript'].lexer + assert_equal Lexer['LSL'], Language['LSL'].lexer assert_equal Lexer['MOOCode'], Language['Moocode'].lexer assert_equal Lexer['MuPAD'], Language['mupad'].lexer assert_equal Lexer['NASM'], Language['Assembly'].lexer @@ -186,6 +187,7 @@ class TestLanguage < Test::Unit::TestCase def test_programming assert_equal :programming, Language['JavaScript'].type + assert_equal :programming, Language['LSL'].type assert_equal :programming, Language['Perl'].type assert_equal :programming, Language['PowerShell'].type assert_equal :programming, Language['Python'].type @@ -326,6 +328,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal '#3581ba', Language['Python'].color assert_equal '#f1e05a', Language['JavaScript'].color assert_equal '#31859c', Language['TypeScript'].color + assert_equal '#3d9970', Language['LSL'].color end def test_colors @@ -338,6 +341,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal 'coffee', Language['CoffeeScript'].ace_mode assert_equal 'csharp', Language['C#'].ace_mode assert_equal 'css', Language['CSS'].ace_mode + assert_equal 'lsl', Language['LSL'].ace_mode assert_equal 'javascript', Language['JavaScript'].ace_mode end @@ -352,6 +356,7 @@ class TestLanguage < Test::Unit::TestCase end def test_extensions + assert Language['LSL'].extensions.include?('.lsl') assert Language['Perl'].extensions.include?('.pl') assert Language['Python'].extensions.include?('.py') assert Language['Ruby'].extensions.include?('.rb')