pygments.rb 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README.md +6 -1
  2. data/lexers +0 -0
  3. data/lib/pygments/version.rb +1 -1
  4. data/vendor/pygments-main/AUTHORS +15 -0
  5. data/vendor/pygments-main/CHANGES +28 -1
  6. data/vendor/pygments-main/LICENSE +1 -1
  7. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +121 -0
  8. data/vendor/pygments-main/pygments/cmdline.py +1 -1
  9. data/vendor/pygments-main/pygments/filters/__init__.py +0 -1
  10. data/vendor/pygments-main/pygments/formatters/_mapping.py +2 -2
  11. data/vendor/pygments-main/pygments/formatters/img.py +1 -1
  12. data/vendor/pygments-main/pygments/formatters/latex.py +8 -8
  13. data/vendor/pygments-main/pygments/formatters/other.py +0 -2
  14. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5413 -0
  15. data/vendor/pygments-main/pygments/lexers/_mapping.py +36 -11
  16. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +551 -0
  17. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +0 -1
  18. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +546 -0
  19. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  20. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +174 -0
  21. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -3
  22. data/vendor/pygments-main/pygments/lexers/agile.py +145 -33
  23. data/vendor/pygments-main/pygments/lexers/asm.py +2 -2
  24. data/vendor/pygments-main/pygments/lexers/compiled.py +328 -36
  25. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  26. data/vendor/pygments-main/pygments/lexers/dotnet.py +8 -14
  27. data/vendor/pygments-main/pygments/lexers/functional.py +773 -8
  28. data/vendor/pygments-main/pygments/lexers/jvm.py +184 -36
  29. data/vendor/pygments-main/pygments/lexers/math.py +349 -23
  30. data/vendor/pygments-main/pygments/lexers/other.py +315 -492
  31. data/vendor/pygments-main/pygments/lexers/parsers.py +83 -1
  32. data/vendor/pygments-main/pygments/lexers/shell.py +4 -1
  33. data/vendor/pygments-main/pygments/lexers/templates.py +112 -2
  34. data/vendor/pygments-main/pygments/lexers/text.py +52 -3
  35. data/vendor/pygments-main/pygments/lexers/web.py +382 -36
  36. data/vendor/pygments-main/pygments/unistring.py +35 -25
  37. data/vendor/pygments-main/pygments/util.py +45 -0
  38. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  39. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  40. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  41. data/vendor/pygments-main/tests/examplefiles/example.ceylon +33 -0
  42. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  43. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  44. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  45. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  46. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  47. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  48. data/vendor/pygments-main/tests/examplefiles/example.stan +97 -0
  49. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  50. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  51. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +123 -0
  52. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  53. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  54. data/vendor/pygments-main/tests/examplefiles/http_request_example +2 -1
  55. data/vendor/pygments-main/tests/examplefiles/http_response_example +4 -2
  56. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  57. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  58. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  59. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  60. data/vendor/pygments-main/tests/examplefiles/matlab_sample +5 -2
  61. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  62. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  63. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  64. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +743 -0
  65. data/vendor/pygments-main/tests/examplefiles/test.R +149 -115
  66. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  67. data/vendor/pygments-main/tests/test_basic_api.py +1 -1
  68. data/vendor/pygments-main/tests/test_util.py +18 -0
  69. metadata +34 -3
  70. data/vendor/pygments-main/REVISION +0 -1
@@ -0,0 +1,78 @@
1
+ \name{foo}
2
+ \alias{foo}
3
+ % I'm a comment
4
+ \title{The foo function}
5
+
6
+ \description{It doesn't do much}
7
+
8
+ \usage{
9
+ foo(x, y)
10
+ }
11
+
12
+ \arguments{
13
+ \item{x}{A number}
14
+ \item{y}{Another number}
15
+ }
16
+ \details{
17
+ I just adds \code{x} and \code{y},
18
+ }
19
+ \value{\code{numeric}. The sum of \code{x} and \code{y}.}
20
+ \references{
21
+ \href{http://en.wikipedia.org/wiki/Sum}{Sum}
22
+ }
23
+ \author{
24
+ Anonymous
25
+ }
26
+ \note{
27
+ Lorem ipsum \dots \R \emph{emp}, \strong{strong}, \bold{bold},
28
+ \sQuote{single quotes}, \dQuote{double quotes}, \code{code},
29
+ \preformatted{x <- 2 + 2}, \kbd{type this}, \samp{literal seq},
30
+ \pkg{base}, \file{foo.txt}, \email{email@hostname},
31
+ \url{http://cran.r-project.org/}, \var{foo}, \env{HOME},
32
+ \option{-d}, \dfn{something new}, \acronym{GNU}.
33
+
34
+ Escaped symbols: \\ \{ \} \% not comment. \\NotAMacro.
35
+
36
+ \tabular{rlll}{
37
+ [,1] \tab alpha \tab numeric \tab A (ppb)\cr
38
+ [,2] \tab bravo \tab integer \tab B \cr
39
+ [,3] \tab charlie \tab character \tab C \cr
40
+ }
41
+ \enumerate{
42
+ \item delta
43
+ \item echo
44
+ }
45
+ \itemize{
46
+ \item foxtrot
47
+ \item golf
48
+ }
49
+
50
+ \deqn{p(x; \mu, \sigma^2) = \frac{1}{\sigma \sqrt{2 \pi}} \exp \frac{-(x - \mu)^2}{2 \sigma}{%
51
+ p(\mu; x) = 1/\sigma (2 \pi)^(-1/2) exp( -(x - \mu)^2 / (2 \sigma)) }
52
+ for \eqn{x = 0, 1, 2, \ldots}.
53
+
54
+ \if{latex}{\out{\beta}}\ifelse{html}{\out{&beta;}}{beta}
55
+
56
+ #ifdef unix
57
+ Now windows
58
+ #endif
59
+ #ifndef windows
60
+ Using windows
61
+ #endif
62
+
63
+ }
64
+ \section{Misc}{
65
+ Stuff.
66
+ }
67
+
68
+ \seealso{
69
+ \code{\link{sum}}
70
+ }
71
+ \examples{
72
+ x <- 1
73
+ y <- 2
74
+ z <- foo(x, y)
75
+ \dontrun{plot(z)}
76
+ \dontshow{log(x)}
77
+ }
78
+ \keyword{arith}
@@ -0,0 +1,54 @@
1
+ # Alligators: multinomial - logistic regression
2
+ # http://www.openbugs.info/Examples/Aligators.html
3
+ model {
4
+ # PRIORS
5
+ alpha[1] <- 0; # zero contrast for baseline food
6
+ for (k in 2 : K) {
7
+ alpha[k] ~ dnorm(0, 0.00001) # vague priors
8
+ }
9
+ # Loop around lakes:
10
+ for (k in 1 : K){
11
+ beta[1, k] <- 0
12
+ } # corner-point contrast with first lake
13
+ for (i in 2 : I) {
14
+ beta[i, 1] <- 0 ; # zero contrast for baseline food
15
+ for (k in 2 : K){
16
+ beta[i, k] ~ dnorm(0, 0.00001) # vague priors
17
+ }
18
+ }
19
+ # Loop around sizes:
20
+ for (k in 1 : K){
21
+ gamma[1, k] <- 0 # corner-point contrast with first size
22
+ }
23
+ for (j in 2 : J) {
24
+ gamma[j, 1] <- 0 ; # zero contrast for baseline food
25
+ for ( k in 2 : K){
26
+ gamma[j, k] ~ dnorm(0, 0.00001) # vague priors
27
+ }
28
+ }
29
+
30
+ # LIKELIHOOD
31
+ for (i in 1 : I) { # loop around lakes
32
+ for (j in 1 : J) { # loop around sizes
33
+
34
+ # Fit standard Poisson regressions relative to baseline
35
+ lambda[i, j] ~ dflat() # vague priors
36
+ for (k in 1 : K) { # loop around foods
37
+ X[i, j, k] ~ dpois(mu[i, j, k])
38
+ log(mu[i, j, k]) <- lambda[i, j] + alpha[k] + beta[i, k] + gamma[j, k]
39
+ culmative.X[i, j, k] <- culmative(X[i, j, k], X[i, j, k])
40
+ }
41
+ }
42
+ }
43
+
44
+ # TRANSFORM OUTPUT TO ENABLE COMPARISON
45
+ # WITH AGRESTI'S RESULTS
46
+ for (k in 1 : K) { # loop around foods
47
+ for (i in 1 : I) { # loop around lakes
48
+ b[i, k] <- beta[i, k] - mean(beta[, k]); # sum to zero constraint
49
+ }
50
+ for (j in 1 : J) { # loop around sizes
51
+ g[j, k] <- gamma[j, k] - mean(gamma[, k]); # sum to zero constraint
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,33 @@
1
+ doc "A top-level function,
2
+ with multi-line documentation."
3
+ void topLevel(String? a, Integer b=5, String... seqs) {
4
+ function nested(String s) {
5
+ print(s[1..2]);
6
+ return true;
7
+ }
8
+ for (s in seqs.filter((String x) x.size > 2)) {
9
+ nested(s);
10
+ }
11
+ value uppers = seqs.sequence[].uppercased;
12
+ String|Nothing z = a;
13
+ Sequence<Integer> ints = { 1, 2, 3, 4, 5 };
14
+ }
15
+
16
+ shared class Example<Element>(name, element) satisfies Comparable<Example<Element>>
17
+ given Element satisfies Comparable<Element> {
18
+ shared String name;
19
+ shared Element element;
20
+
21
+ shared actual Comparison compare(Example<Element> other) {
22
+ return element <=> other.element;
23
+ }
24
+
25
+ shared actual String string {
26
+ return "Example with " + element.string;
27
+ }
28
+ }
29
+
30
+ Example<Integer> instance = Example {
31
+ name = "Named args call";
32
+ element = 5;
33
+ };
@@ -0,0 +1,48 @@
1
+ # lsat.jags example from classic-bugs examples in JAGS
2
+ # See http://sourceforge.net/projects/mcmc-jags/files/Examples/2.x/
3
+ var
4
+ response[R,T], m[R], culm[R], alpha[T], a[T], theta[N], r[N,T],
5
+ p[N,T], beta, theta.new, p.theta[T], p.item[R,T], P.theta[R];
6
+ data {
7
+ for (j in 1:culm[1]) {
8
+ r[j, ] <- response[1, ];
9
+ }
10
+ for (i in 2:R) {
11
+ for (j in (culm[i - 1] + 1):culm[i]) {
12
+ r[j, ] <- response[i, ];
13
+ }
14
+ }
15
+ }
16
+ model {
17
+ # 2-parameter Rasch model
18
+ for (j in 1:N) {
19
+ for (k in 1:T) {
20
+ probit(p[j,k]) <- delta[k]*theta[j] - eta[k];
21
+ r[j,k] ~ dbern(p[j,k]);
22
+ }
23
+ theta[j] ~ dnorm(0,1);
24
+ }
25
+
26
+ # Priors
27
+ for (k in 1:T) {
28
+ eta[k] ~ dnorm(0,0.0001);
29
+ e[k] <- eta[k] - mean(eta[]); # sum-to-zero constraint
30
+
31
+ delta[k] ~ dnorm(0,1) T(0,); # constrain variance to 1, slope +ve
32
+ d[k] <- delta[k]/pow(prod(delta), 1/T); # PRODUCT_k (d_k) = 1
33
+
34
+ g[k] <- e[k]/d[k]; # equivalent to B&A's threshold parameters
35
+ }
36
+
37
+ # Compute probability of response pattern i, for later use in computing G^2
38
+ theta.new ~ dnorm(0,1); # ability parameter for random student
39
+ for(k in 1:T) {
40
+ probit(p.theta[k]) <- delta[k]*theta.new - eta[k];
41
+ for(i in 1:R) {
42
+ p.item[i,k] <- p.theta[k]^response[i,k] * (1-p.theta[k])^(1-response[i,k]);
43
+ }
44
+ }
45
+ for(i in 1:R) {
46
+ P.theta[i] <- prod(p.item[i,])
47
+ }
48
+ }
@@ -0,0 +1,152 @@
1
+ Strict
2
+
3
+ ' single line comment
4
+
5
+ #rem
6
+ multi
7
+ line
8
+ comment
9
+ #end
10
+
11
+ #rem
12
+ nested
13
+ #rem
14
+ multi
15
+ line
16
+ #end
17
+ comment
18
+ #end
19
+
20
+ Import mojo
21
+
22
+ Const ONECONST:Int = 1
23
+ Const TWOCONST := 2
24
+ Const THREECONST := 3, FOURCONST:Int = 4
25
+
26
+ Global someVariable:Int = 4
27
+
28
+ ' sample class from the documentation
29
+ Class Game Extends App
30
+
31
+ Function New()
32
+ End
33
+
34
+ Function DrawSpiral(clock)
35
+ Local w=DeviceWidth/2
36
+ For Local i#=0 Until w*1.5 Step .2
37
+ Local x#,y#
38
+ x=w+i*Sin(i*3+clock)
39
+ y=w+i*Cos(i*2+clock)
40
+ DrawRect x,y,1,1
41
+ Next
42
+ hitbox.Collide(event.pos)
43
+ End
44
+
45
+ Field updateCount
46
+
47
+ Method OnCreate()
48
+ Print "spiral"
49
+
50
+ SetUpdateRate 60
51
+ End
52
+
53
+ Method OnUpdate()
54
+ updateCount+=1
55
+ End
56
+
57
+ Method OnRender()
58
+ Cls
59
+ DrawSpiral updateCount
60
+ DrawSpiral updateCount*1.1
61
+ End
62
+
63
+ End
64
+
65
+ Class Enemy
66
+ Method Die () Abstract
67
+ End
68
+
69
+ ' extending
70
+ Class Hoodlum Extends Enemy
71
+ ' field
72
+ Field testField:Bool = True
73
+
74
+ ' naming class with modulepath
75
+ Local currentNode:list.Node<Vector2D>
76
+
77
+ Method Die ()
78
+ Print "B'oss, he-- he killed me, b'oss!"
79
+ End
80
+ End
81
+
82
+ ' extending with generics
83
+ Class VectorNode Extends Node<Vector2D>
84
+ End
85
+
86
+ ' interfaces
87
+ Interface Computer
88
+ Method Boot ()
89
+ Method Process ()
90
+ Method Display ()
91
+ End
92
+
93
+ Class PC Implements Computer
94
+ End
95
+
96
+ ' array syntax
97
+ Global listOfStuff:String[42]
98
+ Global lessStuff:String[5] = listOfStuff[4..8]
99
+ Global oneStuff:String = listOfStuff[23]
100
+
101
+ 'a comma separated sequence
102
+ Global scores:Int[]=[10,20,30]
103
+ 'a comma separated sequence
104
+ Global text:String[]=["Hello","There","World"]
105
+ Global worstCase:worst.List<String[]>
106
+
107
+ ' string type
108
+ Global string1:String = "Hello world"
109
+ Global string2$ = "Hello world"
110
+
111
+ ' escape characers in strings
112
+ Global string3 := "Hello~zWorld"
113
+ Global string4 := "~qHello World~q"
114
+ Global string5 := "~tIndented~n"
115
+ Global string6 := "tilda is wavey... ~~"
116
+
117
+ ' string pseudofunctions
118
+ Print " Hello World ~n".Trim() ' prints "Hello World"
119
+ Print "Hello World".ToUpper() ' prints "HELLO WORLD"
120
+
121
+ ' Boolean shorttype
122
+ Global boolVariable1:Bool = True
123
+ Global boolVariable2? = False
124
+
125
+ ' number formats
126
+ Global hexNum1:Int = $3d0dead
127
+ Global hexNum2% = $CAFEBABE
128
+
129
+ Global floatNum1:Float = 3.141516
130
+ Global floatNum2# = 3.141516
131
+ Global floatNum3 := .141516
132
+
133
+ ' preprocessor keywords
134
+ #If TARGET = "android"
135
+ DoStuff()
136
+ #ElseIf TARGET = "ios"
137
+ DoOtherStuff()
138
+ #End
139
+
140
+ ' preprocessor variable
141
+ #SOMETHING = True
142
+ #Print SOMETHING
143
+ #If SOMETHING
144
+ #End
145
+
146
+ ' operators
147
+ Global a = 32
148
+ Global b = 32 ~ 0
149
+ b ~= 16
150
+ b |= 16
151
+ b &= 16
152
+ Global c = a | b
@@ -0,0 +1,43 @@
1
+ msc {
2
+ hscale=5;
3
+
4
+ //test comment
5
+
6
+ a,b,c,d;
7
+
8
+ /* another
9
+ comment
10
+ goes here */ /* too */ // now
11
+
12
+ ... [label="test1", id="1"];
13
+ --- [label="test2", id="2"];
14
+ ||| [label="test3", id="2"];
15
+ a ABOX b;
16
+ a--b [label="test4", id="2"];
17
+ a == b [label="test5", id="2"];
18
+ a .. b [label="test6", id="2"];
19
+ a::b [label="test7", id="2"];
20
+ a<<=>> b [label="test8", id="2"],
21
+ b <->c [label="test9", id="2"],
22
+ b RBOX c;
23
+ a BOX d;
24
+ a<=> b [label="test10", id="2"];
25
+ a <<>> b [label="test11", id="2"];
26
+ a<:>b [label="test12", id="2"];
27
+ a->b [label="test13", id="2"];
28
+ a =>> b [label="test14", id="2"],
29
+ b >> c [label="test15", id="2"],
30
+ a=> b [label="test16", id="2"];
31
+ a :>b [label="test17", id="2"];
32
+ a-x b [label="test18", id="2"];
33
+ a -Xb [label="test19", id="2"];
34
+ a<- b [label="test20", id="2"];
35
+ a <<=b [label="test21", id="2"];
36
+ a<< b [label="test22", id="2"];
37
+ a <= b [label="test23", id="2"];
38
+ a<: b [label="test24", id="2"];
39
+ a -xb [label="test25", id="2"];
40
+ a-X b [ label="test26",id="2" ];
41
+ a->* [label="test27" , id="2"];
42
+ *<-b [label="test28",id="28"];
43
+ }
@@ -0,0 +1,19 @@
1
+ Windows Registry Editor Version 5.00
2
+ ; comment
3
+
4
+ [HKEY_CURRENT_USER\SOFTWARE\Pygments]
5
+ @="Hello"
6
+ "Key With Spaces"="Something"
7
+ "Key With ="="With Quotes"
8
+ "Key With = 2"=dword:123
9
+ "Key" = "Value"
10
+ "Hex"=hex(0):1,2,3,a,b,f
11
+ "Hex 2"=hex(5):80,00,00,ff
12
+
13
+ [-HKEY_CURRENT_USER\SOFTWARE\Pygments\Subkey]
14
+
15
+ [HKEY_CURRENT_USER\SOFTWARE\Pygments\Subkey2]
16
+ ; comment
17
+ @=-
18
+ "Foo"=-
19
+ "Foo"="Value"
@@ -0,0 +1,95 @@
1
+ #lang racket
2
+
3
+ ; Single-line comment style.
4
+
5
+ ;; Single-line comment style.
6
+
7
+ #| Multi-line comment style ... on one line |#
8
+
9
+ #|
10
+ Multi-line comment style ...
11
+ ... on multiple lines
12
+ |#
13
+
14
+ (define (a-function x #:keyword [y 0])
15
+ (define foo0 'symbol) ; ()
16
+ [define foo1 'symbol] ; []
17
+ {define foo2 'symbol} ; {}
18
+ (and (append (car '(1 2 3))))
19
+ (regexp-match? #rx"foobar" "foobar")
20
+ (regexp-match? #px"foobar" "foobar")
21
+ (define a 1))
22
+ (let ([b "foo"])
23
+ (displayln b))
24
+ (for/list ([x (in-list (list 1 2 (list 3 4)))])
25
+ (cond
26
+ [(pair? x) (car x)]
27
+ [else x])))
28
+
29
+ ;; Literal number examples
30
+ (values
31
+ ;; #b
32
+ #b1.1
33
+ #b-1.1
34
+ #b1e1
35
+ #b0/1
36
+ #b1/1
37
+ #b1e-1
38
+ #b101
39
+
40
+ ;; #d
41
+ #d-1.23
42
+ #d1.123
43
+ #d1e3
44
+ #d1e-22
45
+ #d1/2
46
+ #d-1/2
47
+ #d1
48
+ #d-1
49
+
50
+ ;; No # reader prefix -- same as #d
51
+ -1.23
52
+ 1.123
53
+ 1e3
54
+ 1e-22
55
+ 1/2
56
+ -1/2
57
+ 1
58
+ -1
59
+
60
+ ;; #e
61
+ #e-1.23
62
+ #e1.123
63
+ #e1e3
64
+ #e1e-22
65
+ #e1
66
+ #e-1
67
+ #e1/2
68
+ #e-1/2
69
+
70
+ ;; #i always float
71
+ #i-1.23
72
+ #i1.123
73
+ #i1e3
74
+ #i1e-22
75
+ #i1/2
76
+ #i-1/2
77
+ #i1
78
+ #i-1
79
+
80
+ ;; #o
81
+ #o777.777
82
+ #o-777.777
83
+ #o777e777
84
+ #o777e-777
85
+ #o3/7
86
+ #o-3/7
87
+ #o777
88
+ #o-777
89
+
90
+ ;; #x
91
+ #x-f.f
92
+ #xf.f
93
+ #x-f
94
+ #xf
95
+ )