pygments.rb 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/README.md +2 -0
  2. data/lexers +0 -0
  3. data/lib/pygments/version.rb +1 -1
  4. data/test/test_pygments.rb +1 -1
  5. data/vendor/custom_lexers/github.py +15 -9
  6. data/vendor/pygments-main/AUTHORS +12 -2
  7. data/vendor/pygments-main/CHANGES +52 -2
  8. data/vendor/pygments-main/REVISION +1 -1
  9. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +52 -0
  10. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +67 -44
  11. data/vendor/pygments-main/pygmentize +1 -1
  12. data/vendor/pygments-main/pygments/filters/__init__.py +2 -2
  13. data/vendor/pygments-main/pygments/formatter.py +3 -0
  14. data/vendor/pygments-main/pygments/lexers/__init__.py +11 -0
  15. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +2880 -3124
  16. data/vendor/pygments-main/pygments/lexers/_mapping.py +30 -20
  17. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +1 -1
  18. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +206 -20
  19. data/vendor/pygments-main/pygments/lexers/agile.py +378 -5
  20. data/vendor/pygments-main/pygments/lexers/asm.py +2 -2
  21. data/vendor/pygments-main/pygments/lexers/compiled.py +235 -8
  22. data/vendor/pygments-main/pygments/lexers/dotnet.py +88 -47
  23. data/vendor/pygments-main/pygments/lexers/functional.py +195 -62
  24. data/vendor/pygments-main/pygments/lexers/github.py +15 -9
  25. data/vendor/pygments-main/pygments/lexers/jvm.py +14 -11
  26. data/vendor/pygments-main/pygments/lexers/math.py +284 -18
  27. data/vendor/pygments-main/pygments/lexers/other.py +132 -21
  28. data/vendor/pygments-main/pygments/lexers/shell.py +29 -15
  29. data/vendor/pygments-main/pygments/lexers/sql.py +1 -1
  30. data/vendor/pygments-main/pygments/lexers/templates.py +8 -8
  31. data/vendor/pygments-main/pygments/lexers/text.py +59 -9
  32. data/vendor/pygments-main/pygments/lexers/web.py +832 -210
  33. data/vendor/pygments-main/pygments/modeline.py +40 -0
  34. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  35. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  36. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  37. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  38. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  39. data/vendor/pygments-main/tests/examplefiles/example.ceylon +29 -10
  40. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  41. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  42. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  43. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  44. data/vendor/pygments-main/tests/examplefiles/example.stan +86 -75
  45. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +40 -30
  46. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  47. data/vendor/pygments-main/tests/examplefiles/objc_example.m +7 -0
  48. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  49. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  50. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  51. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  52. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  53. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  54. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  55. data/vendor/pygments-main/tests/examplefiles/type.lisp +16 -0
  56. data/vendor/pygments-main/tests/test_basic_api.py +3 -3
  57. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  58. metadata +21 -2
@@ -0,0 +1,23 @@
1
+ role q {
2
+ token stopper { \' }
3
+
4
+ token escape:sym<\\> { <sym> <item=.backslash> }
5
+
6
+ token backslash:sym<qq> { <?before 'q'> <quote=.LANG('MAIN','quote')> }
7
+ token backslash:sym<\\> { <text=.sym> }
8
+ token backslash:sym<stopper> { <text=.stopper> }
9
+
10
+ token backslash:sym<miscq> { {} . }
11
+
12
+ method tweak_q($v) { self.panic("Too late for :q") }
13
+ method tweak_qq($v) { self.panic("Too late for :qq") }
14
+ }
15
+
16
+ role qq does b1 does c1 does s1 does a1 does h1 does f1 {
17
+ token stopper { \" }
18
+ token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
19
+ token backslash:sym<misc> { \W }
20
+
21
+ method tweak_q($v) { self.panic("Too late for :q") }
22
+ method tweak_qq($v) { self.panic("Too late for :qq") }
23
+ }
@@ -1,33 +1,52 @@
1
+ import ceylon.language { parseInteger }
2
+
1
3
  doc "A top-level function,
2
4
  with multi-line documentation."
3
- void topLevel(String? a, Integer b=5, String... seqs) {
5
+ void topLevel(String? a, Integer b=5, String* seqs) {
4
6
  function nested(String s) {
5
7
  print(s[1..2]);
6
8
  return true;
7
9
  }
8
- for (s in seqs.filter((String x) x.size > 2)) {
10
+ for (s in seqs.filter((String x) => x.size > 2)) {
9
11
  nested(s);
10
12
  }
11
- value uppers = seqs.sequence[].uppercased;
12
- String|Nothing z = a;
13
- Sequence<Integer> ints = { 1, 2, 3, 4, 5 };
13
+ value uppers = seqs.map((String x) {
14
+ return x.uppercased;
15
+ });
16
+ String|Null z = a;
17
+ {Integer+} ints = { 1, 2, 3, 4, 5 };
18
+ value numbers = [ 1, #ffff, #ffff_ffff, $10101010, $1010_1010_1010_1010,
19
+ 123_456_789 ];
20
+ value chars = ['a', '\{#ffff}' ];
14
21
  }
15
22
 
16
- shared class Example<Element>(name, element) satisfies Comparable<Example<Element>>
23
+ shared class Example_1<Element>(name, element) satisfies Comparable<Example_1<Element>>
17
24
  given Element satisfies Comparable<Element> {
18
25
  shared String name;
19
26
  shared Element element;
27
+ shared [Integer,String] tuple = [1, "2"];
28
+ shared late String lastName;
29
+ variable Integer cnt = 0;
30
+
31
+ shared Integer count => cnt;
32
+ assign count {
33
+ assert(count >= cnt);
34
+ cnt = count;
35
+ }
20
36
 
21
- shared actual Comparison compare(Example<Element> other) {
37
+ shared actual Comparison compare(Example_1<Element> other) {
22
38
  return element <=> other.element;
23
39
  }
24
40
 
25
41
  shared actual String string {
26
- return "Example with " + element.string;
42
+ return "Example with ``element.string``";
27
43
  }
28
44
  }
29
45
 
30
- Example<Integer> instance = Example {
31
- name = "Named args call";
46
+ Example_1<Integer> instance = Example_1 {
32
47
  element = 5;
48
+ name = "Named args call \{#0060}";
33
49
  };
50
+
51
+ object example1 extends Example_1<Integer>("object", 5) {
52
+ }
@@ -0,0 +1,33 @@
1
+
2
+ /// @section StringLiteralRef
3
+
4
+ record StringLiteralRef (
5
+ sizep : Pointer[SizeT],
6
+ );
7
+
8
+
9
+ /// @section predicates
10
+
11
+ overload ContiguousSequence?(#StringLiteralRef) : Bool = true;
12
+ [s when StringLiteral?(s)]
13
+ overload ContiguousSequence?(#Static[s]) : Bool = true;
14
+
15
+
16
+
17
+ /// @section size, begin, end, index
18
+
19
+ forceinline overload size(a:StringLiteralRef) = a.sizep^;
20
+
21
+ forceinline overload begin(a:StringLiteralRef) : Pointer[Char] = Pointer[Char](a.sizep + 1);
22
+ forceinline overload end(a:StringLiteralRef) = begin(a) + size(a);
23
+
24
+ [I when Integer?(I)]
25
+ forceinline overload index(a:StringLiteralRef, i:I) : ByRef[Char] {
26
+ assert["boundsChecks"](i >= 0 and i < size(a), "StringLiteralRef index out of bounds");
27
+ return ref (begin(a) + i)^;
28
+ }
29
+
30
+ foo() = """
31
+ long\tlong
32
+ story
33
+ """
@@ -0,0 +1,142 @@
1
+ /**
2
+ * This is not really a valid Haxe file, but just an demo...
3
+ */
4
+
5
+ package;
6
+ package net.onthewings;
7
+
8
+ import net.onthewings.Test;
9
+ import net.onthewings.*;
10
+
11
+ using Lambda;
12
+ using net.onthewings.Test;
13
+
14
+ #if flash8
15
+ // Haxe code specific for flash player 8
16
+ #elseif flash
17
+ // Haxe code specific for flash platform (any version)
18
+ #elseif js
19
+ // Haxe code specific for javascript plaform
20
+ #elseif neko
21
+ // Haxe code specific for neko plaform
22
+ #else
23
+ // do something else
24
+ #error // will display an error "Not implemented on this platform"
25
+ #error "Custom error message" // will display an error "Custom error message"
26
+ #end
27
+
28
+ 0; // Int
29
+ -134; // Int
30
+ 0xFF00; // Int
31
+
32
+ 123.0; // Float
33
+ .14179; // Float
34
+ 13e50; // Float
35
+ -1e-99; // Float
36
+
37
+ "hello"; // String
38
+ "hello \"world\" !"; // String
39
+ 'hello "world" !'; // String
40
+
41
+ true; // Bool
42
+ false; // Bool
43
+
44
+ null; // Unknown<0>
45
+
46
+ ~/[a-z]+/i; // EReg : regular expression
47
+
48
+ var point = { "x" : 1, "y" : -5 };
49
+
50
+ {
51
+ var x;
52
+ var y = 3;
53
+ var z : String;
54
+ var w : String = "";
55
+ var a, b : Bool, c : Int = 0;
56
+ }
57
+
58
+ //haxe3 pattern matching
59
+ switch(e.expr) {
60
+ case EConst(CString(s)) if (StringTools.startsWith(s, "foo")):
61
+ "1";
62
+ case EConst(CString(s)) if (StringTools.startsWith(s, "bar")):
63
+ "2";
64
+ case EConst(CInt(i)) if (switch(Std.parseInt(i) * 2) { case 4: true; case _: false; }):
65
+ "3";
66
+ case EConst(_):
67
+ "4";
68
+ case _:
69
+ "5";
70
+ }
71
+
72
+ switch [true, 1, "foo"] {
73
+ case [true, 1, "foo"]: "0";
74
+ case [true, 1, _]: "1";
75
+ case _: "_";
76
+ }
77
+
78
+
79
+ class Test <T:Void->Void> {
80
+ private function new():Void {
81
+ inline function innerFun(a:Int, b:Int):Int {
82
+ return readOnlyField = a + b;
83
+ }
84
+
85
+ _innerFun(1, 2.3);
86
+ }
87
+
88
+ static public var instance(get,null):Test;
89
+ static function get_instance():Test {
90
+ return instance != null ? instance : instance = new Test();
91
+ }
92
+ }
93
+
94
+ @:native("Test") private class Test2 {}
95
+
96
+ extern class Ext {}
97
+
98
+ @:macro class M {
99
+ @:macro static function test(e:Array<Expr>):ExprOf<String> {
100
+ return macro "ok";
101
+ }
102
+ }
103
+
104
+ enum Color {
105
+ Red;
106
+ Green;
107
+ Blue;
108
+ Grey( v : Int );
109
+ Rgb( r : Int, g : Int, b : Int );
110
+ Alpha( a : Int, col : Color );
111
+ }
112
+
113
+ class Colors {
114
+ static function toInt( c : Color ) : Int {
115
+ return switch( c ) {
116
+ case Red: 0xFF0000;
117
+ case Green: 0x00FF00;
118
+ case Blue: 0x0000FF;
119
+ case Grey(v): (v << 16) | (v << 8) | v;
120
+ case Rgb(r,g,b): (r << 16) | (g << 8) | b;
121
+ case Alpha(a,c): (a << 24) | (toInt(c) & 0xFFFFFF);
122
+ }
123
+ }
124
+ }
125
+
126
+ class EvtQueue<T : (Event, EventDispatcher)> {
127
+ var evt : T;
128
+ }
129
+
130
+ typedef DS = Dynamic<String>;
131
+ typedef Pt = {
132
+ var x:Float;
133
+ var y:Float;
134
+ @:optional var z:Float; /* optional z */
135
+ function add(pt:Pt):Void;
136
+ }
137
+ typedef Pt2 = {
138
+ x:Float,
139
+ y:Float,
140
+ ?z:Float, //optional z
141
+ add : Point -> Void,
142
+ }
@@ -0,0 +1,19 @@
1
+ \documentclass{article}
2
+ % this is a LaTeX comment
3
+ \usepackage{agda}
4
+
5
+ \begin{document}
6
+
7
+ Here's how you can define \emph{RGB} colors in Agda:
8
+
9
+ \begin{code}
10
+ module example where
11
+
12
+ open import Data.Fin
13
+ open import Data.Nat
14
+
15
+ data Color : Set where
16
+ RGB : Fin 256 → Fin 256 → Fin 256 → Color
17
+ \end{code}
18
+
19
+ \end{document}
@@ -0,0 +1,50 @@
1
+ /* REXX example. */
2
+
3
+ /* Some basic constructs. */
4
+ almost_pi = 0.1415 + 3
5
+ if almost_pi < 3 then
6
+ say 'huh?'
7
+ else do
8
+ say 'almost_pi=' almost_pi || " - ok"
9
+ end
10
+ x = '"' || "'" || '''' || """" /* quotes */
11
+
12
+ /* A comment
13
+ * spawning multiple
14
+ lines. /* / */
15
+
16
+ /* Built-in functions. */
17
+ line = 'line containing some short text'
18
+ say WordPos(line, 'some')
19
+ say Word(line, 4)
20
+
21
+ /* Labels and procedures. */
22
+ some_label :
23
+
24
+ divide: procedure
25
+ parse arg some other
26
+ return some / other
27
+
28
+ call divide(5, 2)
29
+
30
+ /* Loops */
31
+ do i = 1 to 5
32
+ do j = -3 to -9 by -3
33
+ say i '+' j '=' i + j
34
+ end j
35
+ end i
36
+
37
+ do forever
38
+ leave
39
+ end
40
+
41
+ /* Print a text file on MVS. */
42
+ ADDRESS TSO
43
+ "ALLOC F(TEXTFILE) DSN('some.text.dsn') SHR REU"
44
+ "EXECIO * DISKR TEXTFILE ( FINIS STEM LINES."
45
+ "FREE F(TEXTFILE)"
46
+ I = 1
47
+ DO WHILE I <= LINES.0
48
+ SAY ' LINE ' I ' : ' LINES.I
49
+ I = I + 1
50
+ END
@@ -6,92 +6,103 @@ It is not a real model and will not compile
6
6
  # also a comment
7
7
  // also a comment
8
8
  data {
9
- // valid name
10
- int abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc;
11
- // all types should be highlighed
12
- int a3;
13
- real foo[2];
14
- vector[3] bar;
15
- row_vector[3] baz;
16
- matrix[3,3] qux;
17
- simplex[3] quux;
18
- ordered[3] corge;
19
- positive_ordered[3] wibble;
20
- corr_matrix[3] grault;
21
- cov_matrix[3] garply;
22
-
23
- real<lower=-1,upper=1> foo1;
24
- real<lower=0> foo2;
25
- real<upper=0> foo3;
26
-
27
- // bad names
28
- // includes .
29
- // real foo.;
30
- // beings with number
31
- //real 0foo;
32
- // begins with _
33
- //real _foo;
9
+ // valid name
10
+ int abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc;
11
+ // all types should be highlighed
12
+ int a3;
13
+ real foo[2];
14
+ vector[3] bar;
15
+ row_vector[3] baz;
16
+ matrix[3,3] qux;
17
+ simplex[3] quux;
18
+ ordered[3] corge;
19
+ positive_ordered[3] wibble;
20
+ corr_matrix[3] grault;
21
+ cov_matrix[3] garply;
22
+
23
+ real<lower=-1,upper=1> foo1;
24
+ real<lower=0> foo2;
25
+ real<upper=0> foo3;
34
26
  }
35
27
  transformed data {
36
- real xyzzy;
37
- int thud;
38
- row_vector grault2;
39
- matrix qux2;
40
-
41
- // all floating point literals should be recognized
42
- // all operators should be recognized
43
- // paren should be recognized;
44
- xyzzy <- 1234.5687 + .123 - (2.7e3 / 2E-5 * 135e-5);
45
- // integer literal
46
- thud <- -12309865;
47
- // ./ and .* should be recognized as operators
48
- grault2 <- grault .* garply ./ garply;
49
- // ' and \ should be regognized as operators
50
- qux2 <- qux' \ bar;
51
-
28
+ real xyzzy;
29
+ int thud;
30
+ row_vector grault2;
31
+ matrix qux2;
32
+
33
+ // all floating point literals should be recognized
34
+ // all operators should be recognized
35
+ // paren should be recognized;
36
+ xyzzy <- 1234.5687 + .123 - (2.7e3 / 2E-5 * 135e-5);
37
+ // integer literal
38
+ thud <- -12309865;
39
+ // ./ and .* should be recognized as operators
40
+ grault2 <- grault .* garply ./ garply;
41
+ // ' and \ should be regognized as operators
42
+ qux2 <- qux' \ bar;
43
+
52
44
  }
53
45
  parameters {
54
- real fred;
55
- real plugh;
56
-
46
+ real fred;
47
+ real plugh;
57
48
  }
58
49
  transformed parameters {
59
50
  }
60
51
  model {
61
- // ~, <- are operators,
62
- // T may be be recognized
63
- // normal is a function
64
- fred ~ normal(0, 1) T(-0.5, 0.5);
65
- // interior block
66
- {
67
- real tmp;
68
- // for, in should be highlighted
69
- for (i in 1:10) {
70
- tmp <- tmp + 0.1;
71
- }
72
- }
73
- // lp__ should be highlighted
74
- // normal_log as a function
75
- lp__ <- lp__ + normal_log(plugh, 0, 1);
52
+ // ~, <- are operators,
53
+ // T may be be recognized
54
+ // normal is a function
55
+ fred ~ normal(0, 1) T(-0.5, 0.5);
56
+ real tmp;
57
+ // C++ reserved
58
+ real public;
59
+
60
+ // control structures
61
+ for (i in 1:10) {
62
+ tmp <- tmp + 0.1;
63
+ }
64
+ tmp <- 0.0;
65
+ while (tmp < 5.0) {
66
+ tmp <- tmp + 1;
67
+ }
68
+ if (tmp > 0.0) {
69
+ print(tmp);
70
+ } else {
71
+ print(tmp);
72
+ }
76
73
 
77
- // print statement and string literal
78
- print("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~@#$%^&*`'-+={}[].,;: ");
79
- print("Hello, world!");
80
- print("");
74
+ // operators
75
+ tmp || tmp;
76
+ tmp && tmp;
77
+ tmp == tmp;
78
+ tmp != tmp;
79
+ tmp < tmp;
80
+ tmp <= tmp;
81
+ tmp > tmp;
82
+ tmp >= tmp;
83
+ tmp + tmp;
84
+ tmp - tmp;
85
+ tmp * tmp;
86
+ tmp / tmp;
87
+ tmp .* tmp;
88
+ tmp ./ tmp;
89
+ ! tmp;
90
+ - tmp;
91
+ + tmp;
92
+ tmp ';
81
93
 
94
+ // lp__ should be highlighted
95
+ // normal_log as a function
96
+ lp__ <- lp__ + normal_log(plugh, 0, 1);
97
+
98
+ // print statement and string literal
99
+ print("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~@#$%^&*`'-+={}[].,;: ");
100
+ print("Hello, world!");
101
+ print("");
102
+
82
103
  }
83
104
  generated quantities {
84
- real bar1;
85
- bar1 <- foo + 1;
105
+ real bar1;
106
+ bar1 <- foo + 1;
86
107
  }
87
108
 
88
- ## Baddness
89
- //foo <- 2.0;
90
- //foo ~ normal(0, 1);
91
- //not_a_block {
92
- //}
93
-
94
- /*
95
- what happens with this?
96
- */
97
- // */