diff options
| author | Georg Brandl <georg@python.org> | 2021-01-18 21:24:00 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2021-01-18 22:08:36 +0100 |
| commit | 2a3d3a7d5b9c60dedf6638d876161d9563faebcf (patch) | |
| tree | 809c0b4a686db98f5954afa1944404cd9652c6b2 /tests/lexers/js/example.txt | |
| parent | f0445be718da83541ea3401aad882f3937147263 (diff) | |
| download | pygments-git-examplefiles.tar.gz | |
Move test_examplefiles to new tests/lexers scheme.examplefiles
Diffstat (limited to 'tests/lexers/js/example.txt')
| -rw-r--r-- | tests/lexers/js/example.txt | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/tests/lexers/js/example.txt b/tests/lexers/js/example.txt new file mode 100644 index 00000000..9f894664 --- /dev/null +++ b/tests/lexers/js/example.txt @@ -0,0 +1,175 @@ +---input--- +// regex + +blah(/abc/); +x = /abc/; +x = /abc/.match; + +// math + +blah(1/2); //comment +x = 1 / 2 / 3; +x = 1/1/.1; + +// broken + +x=/1/; +x=1/a/g; +x=a/a/g; + +// real-world + +var x = 1/(1+Math.sqrt(sum)); // convert to number between 1-0 +return Math.round((num / den) * 100)/100; + +---tokens--- +'' Text +'// regex\n' Comment.Single + +'\n' Text + +'blah' Name.Other +'(' Punctuation +'/abc/' Literal.String.Regex +')' Punctuation +';' Punctuation +'\n' Text + +'x' Name.Other +' ' Text +'=' Operator +' ' Text +'/abc/' Literal.String.Regex +';' Punctuation +'\n' Text + +'x' Name.Other +' ' Text +'=' Operator +' ' Text +'/abc/' Literal.String.Regex +'.' Punctuation +'match' Name.Other +';' Punctuation +'\n\n' Text + +'// math\n' Comment.Single + +'\n' Text + +'blah' Name.Other +'(' Punctuation +'1' Literal.Number.Float +'/' Operator +'2' Literal.Number.Float +')' Punctuation +';' Punctuation +' ' Text +'//comment\n' Comment.Single + +'x' Name.Other +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Float +' ' Text +'/' Operator +' ' Text +'2' Literal.Number.Float +' ' Text +'/' Operator +' ' Text +'3' Literal.Number.Float +';' Punctuation +'\n' Text + +'x' Name.Other +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Float +'/' Operator +'1' Literal.Number.Float +'/' Operator +'.1' Literal.Number.Float +';' Punctuation +'\n\n' Text + +'// broken\n' Comment.Single + +'\n' Text + +'x' Name.Other +'=' Operator +'/1/' Literal.String.Regex +';' Punctuation +'\n' Text + +'x' Name.Other +'=' Operator +'1' Literal.Number.Float +'/' Operator +'a' Name.Other +'/' Operator +'g' Name.Other +';' Punctuation +'\n' Text + +'x' Name.Other +'=' Operator +'a' Name.Other +'/' Operator +'a' Name.Other +'/' Operator +'g' Name.Other +';' Punctuation +'\n\n' Text + +'// real-world\n' Comment.Single + +'\n' Text + +'var' Keyword.Declaration +' ' Text +'x' Name.Other +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Float +'/' Operator +'(' Punctuation +'1' Literal.Number.Float +'+' Operator +'Math' Name.Builtin +'.' Punctuation +'sqrt' Name.Other +'(' Punctuation +'sum' Name.Other +')' Punctuation +')' Punctuation +';' Punctuation +' ' Text +'// convert to number between 1-0\n' Comment.Single + +'return' Keyword +' ' Text +'Math' Name.Builtin +'.' Punctuation +'round' Name.Other +'(' Punctuation +'(' Punctuation +'num' Name.Other +' ' Text +'/' Operator +' ' Text +'den' Name.Other +')' Punctuation +' ' Text +'*' Operator +' ' Text +'100' Literal.Number.Float +')' Punctuation +'/' Operator +'100' Literal.Number.Float +';' Punctuation +'\n' Text |
