From c71dfd1cf215d8a92149ea92b12502e8a9251cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Fri, 5 Mar 2021 11:14:46 +0100 Subject: Update to new test system. --- CHANGES | 4 + pygments/lexers/thingsdb.py | 2 + tests/examplefiles/test.ti | 76 ------ tests/examplefiles/thingsdb/test.ti | 76 ++++++ tests/examplefiles/thingsdb/test.ti.output | 424 +++++++++++++++++++++++++++++ 5 files changed, 506 insertions(+), 76 deletions(-) delete mode 100644 tests/examplefiles/test.ti create mode 100644 tests/examplefiles/thingsdb/test.ti create mode 100644 tests/examplefiles/thingsdb/test.ti.output diff --git a/CHANGES b/CHANGES index 2e9b3742..8f209474 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,10 @@ Version 2.9.0 ------------- (not released yet) +- Added lexers: + + * ThingsDB (#1295) + - Updated lexers: * C/C++: Improve namespace handling (#1722, #1561, #1719) diff --git a/pygments/lexers/thingsdb.py b/pygments/lexers/thingsdb.py index 01ce77f6..37f64e56 100644 --- a/pygments/lexers/thingsdb.py +++ b/pygments/lexers/thingsdb.py @@ -20,6 +20,8 @@ __all__ = ['ThingsDBLexer'] class ThingsDBLexer(RegexLexer): """ Lexer for the ThingsDB programming language. + + .. versionadded:: 2.9 """ name = 'ThingsDB' aliases = ['ti', 'thingsdb'] diff --git a/tests/examplefiles/test.ti b/tests/examplefiles/test.ti deleted file mode 100644 index a45411d0..00000000 --- a/tests/examplefiles/test.ti +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Multi-line comment - */ - -// Single line comment - -[ - 0b110 & 0b011, - 0b110 | 0b011, - 0b110 ^ 0b011, -]; - -x = 0; -[ - false && x += 1, - true || x += 1, - x -]; // expression x += 1 will never be executed - -0b101010; -0xff; -+0.314e+1; -nan; --inf; -inf; -42; --10; - -!false; - -true; -false; -nil; // nil -/.*test/i; - -'single quote string'; -"double quote string"; - -nodes_info(); -id(); -.id(); -.add(#12, #42); - -variable; -.property; - -|x, y| x + y; - -{ - nil; // block -} - -.users.map(|user| { - // property, with function and closure - user.name; -}); - -x.y.z.filter(|| true); - -.iris = { - name: 'Iris', - age: 6, -}; - -.arr = [1, 2, 3]; - -cato = {} - -x = { - 6 * 7; /* yes, 42 ! */ -}; - -a == b; -a += 1; - -bool = (a == b || (a == c && c != d)); diff --git a/tests/examplefiles/thingsdb/test.ti b/tests/examplefiles/thingsdb/test.ti new file mode 100644 index 00000000..a45411d0 --- /dev/null +++ b/tests/examplefiles/thingsdb/test.ti @@ -0,0 +1,76 @@ +/* + * Multi-line comment + */ + +// Single line comment + +[ + 0b110 & 0b011, + 0b110 | 0b011, + 0b110 ^ 0b011, +]; + +x = 0; +[ + false && x += 1, + true || x += 1, + x +]; // expression x += 1 will never be executed + +0b101010; +0xff; ++0.314e+1; +nan; +-inf; +inf; +42; +-10; + +!false; + +true; +false; +nil; // nil +/.*test/i; + +'single quote string'; +"double quote string"; + +nodes_info(); +id(); +.id(); +.add(#12, #42); + +variable; +.property; + +|x, y| x + y; + +{ + nil; // block +} + +.users.map(|user| { + // property, with function and closure + user.name; +}); + +x.y.z.filter(|| true); + +.iris = { + name: 'Iris', + age: 6, +}; + +.arr = [1, 2, 3]; + +cato = {} + +x = { + 6 * 7; /* yes, 42 ! */ +}; + +a == b; +a += 1; + +bool = (a == b || (a == c && c != d)); diff --git a/tests/examplefiles/thingsdb/test.ti.output b/tests/examplefiles/thingsdb/test.ti.output new file mode 100644 index 00000000..b34c9d2e --- /dev/null +++ b/tests/examplefiles/thingsdb/test.ti.output @@ -0,0 +1,424 @@ +'/*' Comment.Multiline +'\n ' Comment.Multiline +'*' Comment.Multiline +' Multi-line comment\n ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'// Single line comment\n' Comment.Single + +'\n' Text.Whitespace + +'[' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'&' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'|' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +']' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'[' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'false' Keyword.Constant +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'true' Keyword.Constant +' ' Text.Whitespace +'|' Operator +'|' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'x' Name.Variable +'\n' Text.Whitespace + +']' Punctuation +';' Punctuation +' ' Text.Whitespace +'// expression x += 1 will never be executed\n' Comment.Single + +'\n' Text.Whitespace + +'0b101010' Literal.Number.Bin +';' Punctuation +'\n' Text.Whitespace + +'0xff' Literal.Number.Hex +';' Punctuation +'\n' Text.Whitespace + +'+0' Literal.Number.Integer +'.314e+1' Literal.Number.Float +';' Punctuation +'\n' Text.Whitespace + +'nan;' Literal.Number.Float +'\n' Text.Whitespace + +'-inf;' Literal.Number.Float +'\n' Text.Whitespace + +'inf;' Literal.Number.Float +'\n' Text.Whitespace + +'42' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'-10' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'!' Operator +'false' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'true' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'false' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'nil' Keyword.Constant +';' Punctuation +' ' Text.Whitespace +'// nil\n' Comment.Single + +'/.*test/i' Literal.String.Regex +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +"'single quote string'" Literal.String.Single +';' Punctuation +'\n' Text.Whitespace + +'"double quote string"' Literal.String.Double +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'nodes_info' Name.Function +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'id' Name.Variable +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'.' Name.Function +'id' Name.Function +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'.' Name.Function +'add' Name.Function +'(' Punctuation +'#12' Comment.Preproc +',' Punctuation +' ' Text.Whitespace +'#42' Comment.Preproc +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'variable' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'.property' Name.Attribute +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'|' Operator +'x' Name.Variable +',' Punctuation +' ' Text.Whitespace +'y' Name.Variable +'|' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'y' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'nil' Keyword.Constant +';' Punctuation +' ' Text.Whitespace +'// block\n' Comment.Single + +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.users' Name.Attribute +'.' Name.Function +'map' Name.Function +'(' Punctuation +'|' Operator +'user' Name.Variable +'|' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'// property, with function and closure\n' Comment.Single + +' ' Text.Whitespace +'user' Name.Variable +'.name' Name.Attribute +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +'.y' Name.Attribute +'.z' Name.Attribute +'.' Name.Function +'filter' Name.Function +'(' Punctuation +'|' Operator +'|' Operator +' ' Text.Whitespace +'true' Keyword.Constant +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.iris' Name.Attribute +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'name' Name.Variable +':' Operator +' ' Text.Whitespace +"'Iris'" Literal.String.Single +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'age' Name.Variable +':' Operator +' ' Text.Whitespace +'6' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.arr' Name.Attribute +' ' Text +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'3' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'cato' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'6' Literal.Number.Integer +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'7' Literal.Number.Integer +';' Punctuation +' ' Text.Whitespace +'/*' Comment.Multiline +' yes, 42 ! ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text.Whitespace + +'}' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'b' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'a' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'bool' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'b' Name.Variable +' ' Text.Whitespace +'|' Operator +'|' Operator +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'c' Name.Variable +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'c' Name.Variable +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'d' Name.Variable +')' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace -- cgit v1.2.1