rouge 3.21.0 → 3.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -1
  3. data/lib/rouge/cli.rb +55 -22
  4. data/lib/rouge/demos/brainfuck +1 -1
  5. data/lib/rouge/demos/brightscript +1 -1
  6. data/lib/rouge/demos/bsl +1 -1
  7. data/lib/rouge/demos/cfscript +1 -1
  8. data/lib/rouge/demos/coq +1 -1
  9. data/lib/rouge/demos/csvs +1 -1
  10. data/lib/rouge/demos/dafny +16 -0
  11. data/lib/rouge/demos/datastudio +0 -1
  12. data/lib/rouge/demos/ecl +0 -1
  13. data/lib/rouge/demos/email +11 -0
  14. data/lib/rouge/demos/erlang +1 -1
  15. data/lib/rouge/demos/fluent +13 -0
  16. data/lib/rouge/demos/fsharp +1 -1
  17. data/lib/rouge/demos/glsl +1 -1
  18. data/lib/rouge/demos/haxe +0 -1
  19. data/lib/rouge/demos/idris +13 -0
  20. data/lib/rouge/demos/isabelle +16 -0
  21. data/lib/rouge/demos/j +12 -0
  22. data/lib/rouge/demos/lean +8 -0
  23. data/lib/rouge/demos/meson +10 -0
  24. data/lib/rouge/demos/nesasm +1 -1
  25. data/lib/rouge/demos/nial +35 -0
  26. data/lib/rouge/demos/ocl +4 -0
  27. data/lib/rouge/demos/opentype_feature_file +0 -1
  28. data/lib/rouge/demos/plsql +2 -0
  29. data/lib/rouge/demos/postscript +9 -0
  30. data/lib/rouge/demos/rescript +26 -0
  31. data/lib/rouge/demos/smarty +0 -1
  32. data/lib/rouge/demos/stan +13 -0
  33. data/lib/rouge/demos/stata +14 -0
  34. data/lib/rouge/demos/systemd +4 -0
  35. data/lib/rouge/demos/syzlang +15 -0
  36. data/lib/rouge/demos/syzprog +8 -0
  37. data/lib/rouge/formatter.rb +2 -2
  38. data/lib/rouge/formatters/html_inline.rb +0 -1
  39. data/lib/rouge/formatters/html_line_highlighter.rb +24 -0
  40. data/lib/rouge/formatters/html_line_table.rb +1 -3
  41. data/lib/rouge/formatters/html_linewise.rb +2 -3
  42. data/lib/rouge/guessers/disambiguation.rb +7 -0
  43. data/lib/rouge/lexer.rb +40 -22
  44. data/lib/rouge/lexers/apache/keywords.rb +1 -1
  45. data/lib/rouge/lexers/apex.rb +9 -7
  46. data/lib/rouge/lexers/apple_script.rb +1 -1
  47. data/lib/rouge/lexers/batchfile.rb +2 -1
  48. data/lib/rouge/lexers/c.rb +12 -2
  49. data/lib/rouge/lexers/ceylon.rb +2 -2
  50. data/lib/rouge/lexers/cmake.rb +10 -0
  51. data/lib/rouge/lexers/console.rb +1 -1
  52. data/lib/rouge/lexers/cpp.rb +9 -6
  53. data/lib/rouge/lexers/crystal.rb +14 -9
  54. data/lib/rouge/lexers/cypher.rb +8 -0
  55. data/lib/rouge/lexers/dafny.rb +128 -0
  56. data/lib/rouge/lexers/dart.rb +10 -9
  57. data/lib/rouge/lexers/docker.rb +5 -1
  58. data/lib/rouge/lexers/eex.rb +2 -2
  59. data/lib/rouge/lexers/eiffel.rb +0 -1
  60. data/lib/rouge/lexers/elm.rb +5 -5
  61. data/lib/rouge/lexers/email.rb +39 -0
  62. data/lib/rouge/lexers/factor.rb +2 -2
  63. data/lib/rouge/lexers/fluent.rb +74 -0
  64. data/lib/rouge/lexers/ghc_core.rb +3 -2
  65. data/lib/rouge/lexers/gherkin/keywords.rb +1 -1
  66. data/lib/rouge/lexers/graphql.rb +1 -1
  67. data/lib/rouge/lexers/groovy.rb +1 -1
  68. data/lib/rouge/lexers/hack.rb +1 -1
  69. data/lib/rouge/lexers/handlebars.rb +1 -1
  70. data/lib/rouge/lexers/hcl.rb +1 -0
  71. data/lib/rouge/lexers/http.rb +8 -2
  72. data/lib/rouge/lexers/hylang.rb +0 -1
  73. data/lib/rouge/lexers/idris.rb +210 -0
  74. data/lib/rouge/lexers/isabelle.rb +251 -0
  75. data/lib/rouge/lexers/isbl.rb +2 -2
  76. data/lib/rouge/lexers/j.rb +244 -0
  77. data/lib/rouge/lexers/janet.rb +9 -8
  78. data/lib/rouge/lexers/javascript.rb +9 -3
  79. data/lib/rouge/lexers/jsl.rb +25 -14
  80. data/lib/rouge/lexers/jsonnet.rb +4 -3
  81. data/lib/rouge/lexers/jsp.rb +2 -3
  82. data/lib/rouge/lexers/jsx.rb +1 -2
  83. data/lib/rouge/lexers/kotlin.rb +11 -5
  84. data/lib/rouge/lexers/lasso/keywords.rb +1 -1
  85. data/lib/rouge/lexers/lean.rb +164 -0
  86. data/lib/rouge/lexers/llvm/keywords.rb +1 -1
  87. data/lib/rouge/lexers/lua/keywords.rb +1 -1
  88. data/lib/rouge/lexers/mathematica/keywords.rb +1 -1
  89. data/lib/rouge/lexers/matlab/keywords.rb +1 -1
  90. data/lib/rouge/lexers/matlab.rb +3 -2
  91. data/lib/rouge/lexers/meson.rb +159 -0
  92. data/lib/rouge/lexers/nial.rb +166 -0
  93. data/lib/rouge/lexers/ocaml/common.rb +1 -1
  94. data/lib/rouge/lexers/ocl.rb +84 -0
  95. data/lib/rouge/lexers/opentype_feature_file.rb +0 -1
  96. data/lib/rouge/lexers/pascal.rb +2 -1
  97. data/lib/rouge/lexers/perl.rb +6 -4
  98. data/lib/rouge/lexers/php/keywords.rb +1 -1
  99. data/lib/rouge/lexers/php.rb +276 -128
  100. data/lib/rouge/lexers/plsql.rb +578 -0
  101. data/lib/rouge/lexers/postscript.rb +93 -0
  102. data/lib/rouge/lexers/powershell.rb +39 -29
  103. data/lib/rouge/lexers/prometheus.rb +0 -1
  104. data/lib/rouge/lexers/python.rb +4 -2
  105. data/lib/rouge/lexers/q.rb +1 -2
  106. data/lib/rouge/lexers/reasonml.rb +6 -5
  107. data/lib/rouge/lexers/rescript.rb +119 -0
  108. data/lib/rouge/lexers/ruby.rb +1 -1
  109. data/lib/rouge/lexers/rust.rb +84 -18
  110. data/lib/rouge/lexers/smarty.rb +1 -1
  111. data/lib/rouge/lexers/sparql.rb +5 -4
  112. data/lib/rouge/lexers/sqf/keywords.rb +1 -1
  113. data/lib/rouge/lexers/sql.rb +7 -7
  114. data/lib/rouge/lexers/stan.rb +451 -0
  115. data/lib/rouge/lexers/stata.rb +165 -0
  116. data/lib/rouge/lexers/supercollider.rb +0 -1
  117. data/lib/rouge/lexers/swift.rb +3 -3
  118. data/lib/rouge/lexers/systemd.rb +34 -0
  119. data/lib/rouge/lexers/syzlang.rb +317 -0
  120. data/lib/rouge/lexers/syzprog.rb +122 -0
  121. data/lib/rouge/lexers/tap.rb +0 -1
  122. data/lib/rouge/lexers/toml.rb +16 -9
  123. data/lib/rouge/lexers/tsx.rb +0 -1
  124. data/lib/rouge/lexers/tulip.rb +0 -1
  125. data/lib/rouge/lexers/velocity.rb +1 -1
  126. data/lib/rouge/lexers/viml/keywords.rb +1 -1
  127. data/lib/rouge/lexers/wollok.rb +0 -1
  128. data/lib/rouge/lexers/yaml.rb +1 -1
  129. data/lib/rouge/regex_lexer.rb +56 -1
  130. data/lib/rouge/themes/base16.rb +1 -0
  131. data/lib/rouge/themes/bw.rb +1 -0
  132. data/lib/rouge/themes/colorful.rb +1 -0
  133. data/lib/rouge/themes/github.rb +1 -0
  134. data/lib/rouge/themes/gruvbox.rb +2 -0
  135. data/lib/rouge/themes/igor_pro.rb +1 -0
  136. data/lib/rouge/themes/magritte.rb +1 -0
  137. data/lib/rouge/themes/monokai.rb +1 -0
  138. data/lib/rouge/themes/pastie.rb +1 -0
  139. data/lib/rouge/themes/thankful_eyes.rb +1 -0
  140. data/lib/rouge/themes/tulip.rb +1 -0
  141. data/lib/rouge/version.rb +1 -1
  142. data/lib/rouge.rb +1 -0
  143. metadata +43 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ef1072cc2523dba637a191d195865b0b2fb9f38c4f6d9961fb58748306f6cd1
4
- data.tar.gz: 4cd1b0d5262fa8a1d4ddb564cf4e9a185d6e8043bee0261f119e7a8ccb81e1fd
3
+ metadata.gz: acc37e14414bcaa3f67dda77f1b746f8035cfc972dc807610b4a1ef4fcffe848
4
+ data.tar.gz: 2380291e01345a7251f229dddf858d612f64d89f7ef93d7b75b2c44fa9a093a6
5
5
  SHA512:
6
- metadata.gz: 04a39cda7513ce8084b6cdddd3016e7ca679218688dfb2dcb6f6fd8a0e627ec189f38a31ba2c44bd2a8c5b16191e24d0f343f860db5dfbcbb7ca49b92aaff197
7
- data.tar.gz: 50172d87860fa9fb4b187dee66c72954ce926e0d73f3e78e1a15a7f3437e749d48b2f935fa6ad08be457a6dd317a3c5c20340a7f7cc1621825b97887e82822c1
6
+ metadata.gz: a4d60e1f37e66b4991b040ff82db8cc59983f37923a7f8b41a44a149407167467b443cd6ac8bb47f8800588e82301be1d58c14175bb1513a728952be21144ed8
7
+ data.tar.gz: 6f0e6ab3786ac315f0a2d658d02091bb3b8a0b6cd75ef3aac6dc2a116eee9dd5a45b1a4c9ef11f40f0f6338ae50d7c0f0b219e9ab20de950e4ae865f3824e002
data/Gemfile CHANGED
@@ -8,9 +8,11 @@ gem 'rake'
8
8
 
9
9
  gem 'minitest', '>= 5.0'
10
10
  gem 'minitest-power_assert'
11
+ gem 'power_assert', '~> 1.2'
11
12
 
12
13
  gem 'parallel', '~> 1.13.0' if RUBY_VERSION < '2.2.0'
13
- gem 'rubocop', '~> 0.49.1'
14
+ gem 'rubocop', '~> 1.0', '<= 1.11'
15
+ gem 'rubocop-performance'
14
16
 
15
17
  # don't try to install redcarpet under jruby
16
18
  gem 'redcarpet', :platforms => :ruby
@@ -36,5 +38,8 @@ group :development do
36
38
  else
37
39
  gem 'sinatra'
38
40
  end
41
+
42
+ # Ruby 3 no longer ships with a web server
43
+ gem 'puma' if RUBY_VERSION >= '3'
39
44
  gem 'shotgun'
40
45
  end
data/lib/rouge/cli.rb CHANGED
@@ -44,6 +44,7 @@ module Rouge
44
44
  yield %||
45
45
  yield %|where <command> is one of:|
46
46
  yield %| highlight #{Highlight.desc}|
47
+ yield %| debug #{Debug.desc}|
47
48
  yield %| help #{Help.desc}|
48
49
  yield %| style #{Style.desc}|
49
50
  yield %| list #{List.desc}|
@@ -104,6 +105,8 @@ module Rouge
104
105
  Help
105
106
  when 'highlight', 'hi'
106
107
  Highlight
108
+ when 'debug'
109
+ Debug
107
110
  when 'style'
108
111
  Style
109
112
  when 'list'
@@ -171,35 +174,38 @@ module Rouge
171
174
  yield %[usage: rougify highlight <filename> [options...]]
172
175
  yield %[ rougify highlight [options...]]
173
176
  yield %[]
174
- yield %[--input-file|-i <filename> specify a file to read, or - to use stdin]
177
+ yield %[--input-file|-i <filename> specify a file to read, or - to use stdin]
175
178
  yield %[]
176
- yield %[--lexer|-l <lexer> specify the lexer to use.]
177
- yield %[ If not provided, rougify will try to guess]
178
- yield %[ based on --mimetype, the filename, and the]
179
- yield %[ file contents.]
179
+ yield %[--lexer|-l <lexer> specify the lexer to use.]
180
+ yield %[ If not provided, rougify will try to guess]
181
+ yield %[ based on --mimetype, the filename, and the]
182
+ yield %[ file contents.]
180
183
  yield %[]
181
- yield %[--formatter|-f <opts> specify the output formatter to use.]
182
- yield %[ If not provided, rougify will default to]
183
- yield %[ terminal256.]
184
+ yield %[--formatter-preset|-f <opts> specify the output formatter to use.]
185
+ yield %[ If not provided, rougify will default to]
186
+ yield %[ terminal256. options are: terminal256,]
187
+ yield %[ terminal-truecolor, html, html-pygments,]
188
+ yield %[ html-inline, html-line-table, html-table,]
189
+ yield %[ null/raw/tokens, or tex.]
184
190
  yield %[]
185
- yield %[--theme|-t <theme> specify the theme to use for highlighting]
186
- yield %[ the file. (only applies to some formatters)]
191
+ yield %[--theme|-t <theme> specify the theme to use for highlighting]
192
+ yield %[ the file. (only applies to some formatters)]
187
193
  yield %[]
188
- yield %[--mimetype|-m <mimetype> specify a mimetype for lexer guessing]
194
+ yield %[--mimetype|-m <mimetype> specify a mimetype for lexer guessing]
189
195
  yield %[]
190
- yield %[--lexer-opts|-L <opts> specify lexer options in CGI format]
191
- yield %[ (opt1=val1&opt2=val2)]
196
+ yield %[--lexer-opts|-L <opts> specify lexer options in CGI format]
197
+ yield %[ (opt1=val1&opt2=val2)]
192
198
  yield %[]
193
- yield %[--formatter-opts|-F <opts> specify formatter options in CGI format]
194
- yield %[ (opt1=val1&opt2=val2)]
199
+ yield %[--formatter-opts|-F <opts> specify formatter options in CGI format]
200
+ yield %[ (opt1=val1&opt2=val2)]
195
201
  yield %[]
196
- yield %[--require|-r <filename> require a filename or library before]
197
- yield %[ highlighting]
202
+ yield %[--require|-r <filename> require a filename or library before]
203
+ yield %[ highlighting]
198
204
  yield %[]
199
- yield %[--escape allow the use of escapes between <! and !>]
205
+ yield %[--escape allow the use of escapes between <! and !>]
200
206
  yield %[]
201
- yield %[--escape-with <l> <r> allow the use of escapes between custom]
202
- yield %[ delimiters. implies --escape]
207
+ yield %[--escape-with <l> <r> allow the use of escapes between custom]
208
+ yield %[ delimiters. implies --escape]
203
209
  end
204
210
 
205
211
  # There is no consistent way to do this, but this is used elsewhere,
@@ -215,7 +221,7 @@ module Rouge
215
221
  end
216
222
  end
217
223
 
218
- def self.parse(argv)
224
+ def self.parse_opts(argv)
219
225
  opts = {
220
226
  :formatter => supports_truecolor? ? 'terminal-truecolor' : 'terminal256',
221
227
  :theme => 'thankful_eyes',
@@ -256,7 +262,11 @@ module Rouge
256
262
  end
257
263
  end
258
264
 
259
- new(opts)
265
+ opts
266
+ end
267
+
268
+ def self.parse(argv)
269
+ new(parse_opts(argv))
260
270
  end
261
271
 
262
272
  def input_stream
@@ -344,6 +354,29 @@ module Rouge
344
354
  end
345
355
  end
346
356
 
357
+ class Debug < Highlight
358
+ def self.desc
359
+ end
360
+
361
+ def self.doc
362
+ return enum_for(:doc) unless block_given?
363
+
364
+ yield %|usage: rougify debug [<options>]|
365
+ yield %||
366
+ yield %|Debug a lexer. Similar options to `rougify highlight`, but|
367
+ yield %|defaults to the `null` formatter, and ensures the `debug`|
368
+ yield %|option is enabled, to print debugging information to stdout.|
369
+ end
370
+
371
+ def self.parse_opts(argv)
372
+ out = super(argv)
373
+ out[:lexer_opts]['debug'] = '1'
374
+ out[:formatter] = 'null'
375
+
376
+ out
377
+ end
378
+ end
379
+
347
380
  class Style < CLI
348
381
  def self.desc
349
382
  "print CSS styles"
@@ -2,4 +2,4 @@
2
2
  This is a sample
3
3
  comment.
4
4
  ]
5
- .[>+<-]>,
5
+ .[>+<-]>,
@@ -3,4 +3,4 @@ function main(args as dynamic) as void
3
3
  'Create a scene and load /components/helloworld.xml'
4
4
  scene = screen.CreateScene("HelloWorld")
5
5
  screen.show()
6
- end function
6
+ end function
data/lib/rouge/demos/bsl CHANGED
@@ -4,4 +4,4 @@
4
4
  Сообщить("Привет мир");
5
5
  КонецПроцедуры
6
6
 
7
- #КонецОбласти
7
+ #КонецОбласти
@@ -15,4 +15,4 @@ component accessors="true" {
15
15
 
16
16
  return foo;
17
17
  }
18
- }
18
+ }
data/lib/rouge/demos/coq CHANGED
@@ -10,4 +10,4 @@ Section with_T.
10
10
  end.
11
11
  End with_T.
12
12
 
13
- Definition a_string := "hello \" world".
13
+ Definition a_string := "hello \" world".
data/lib/rouge/demos/csvs CHANGED
@@ -5,4 +5,4 @@ Transaction_Date: xDate
5
5
  Transaction_ID: notEmpty
6
6
  Originator_Name: notEmpty
7
7
  Originator_Address: any("yes","no")
8
- Originator_Country: notEmpty
8
+ Originator_Country: notEmpty
@@ -0,0 +1,16 @@
1
+ module A {
2
+ const i: int := 56_78
3
+ }
4
+
5
+ method m(b: bool, s: string) {
6
+ var x: string;
7
+ var i: int;
8
+ if b then i := 1; else i := 2;
9
+ i := if b 1 else 2;
10
+ assert b;
11
+ assume b;
12
+ print s;
13
+ expect b;
14
+ }
15
+
16
+ function f(i: int): int { i + 1 }
@@ -18,4 +18,3 @@ select * from TABLE1 where COL1 like %VAR1%; //utiliser la variable VAR1 dans un
18
18
 
19
19
  select * from TEST_TABLE; //exécution d'une requête Select pour ramener des valeurs
20
20
  Affect_LastColumns("TEST1"); //création du paramètre TEST1
21
-
data/lib/rouge/demos/ecl CHANGED
@@ -15,4 +15,3 @@ somePeople := allPeople(LastName = 'Smith');
15
15
 
16
16
  // Outputs ---
17
17
  somePeople;
18
-
@@ -0,0 +1,11 @@
1
+ From: Me <me@example.com>
2
+ To: You <you@example.com>
3
+ Date: Tue, 21 Jul 2020 15:14:03 +0000
4
+ Subject: A very important message
5
+
6
+ > Please investigate. Thank you.
7
+
8
+ I have investigated.
9
+
10
+ --
11
+ This message is highly confidential and will self-destruct.
@@ -4,4 +4,4 @@
4
4
 
5
5
  %% Compute rectangle and circle area.
6
6
  area({rectangle, Width, Ht}) -> Width * Ht;
7
- area({circle, R}) -> 3.14159 * R * R.
7
+ area({circle, R}) -> 3.14159 * R * R.
@@ -0,0 +1,13 @@
1
+ # Simple things are simple.
2
+ hello-user = Hello, {$userName}!
3
+
4
+ # Complex things are possible.
5
+ shared-photos =
6
+ {$userName} {$photoCount ->
7
+ [one] added a new photo
8
+ *[other] added {$photoCount} new photos
9
+ } to {$userGender ->
10
+ [male] his stream
11
+ [female] her stream
12
+ *[other] their stream
13
+ }.
@@ -9,4 +9,4 @@ let rec existsLeaf test tree =
9
9
  || existsLeaf test right
10
10
 
11
11
  let hasEvenLeaf tree =
12
- existsLeaf (fun n -> n % 2 = 0) tree
12
+ existsLeaf (fun n -> n % 2 = 0) tree
data/lib/rouge/demos/glsl CHANGED
@@ -11,4 +11,4 @@ void main()
11
11
  {
12
12
  vertexColor = color;
13
13
  gl_Position = vec4(position, 0.0, 1.0);
14
- }
14
+ }
data/lib/rouge/demos/haxe CHANGED
@@ -2,4 +2,3 @@
2
2
  public static function hello(arg : String) {
3
3
  return 'Hello $arg';
4
4
  }
5
-
@@ -0,0 +1,13 @@
1
+ import Data.Vect
2
+
3
+ insert : Ord elem =>
4
+ (x : elem) -> (xsSorted : Vect len elem) -> Vect (S len) elem
5
+ insert x [] = [x]
6
+ insert x (y :: xs) = case x < y of
7
+ True => x :: y :: xs
8
+ False => y :: insert x xs
9
+
10
+ insSort : Ord elem => Vect n elem -> Vect n elem
11
+ insSort [] = []
12
+ insSort (x :: xs) = let xsSorted = insSort xs in
13
+ insert x xsSorted
@@ -0,0 +1,16 @@
1
+ theory demo imports Main begin
2
+
3
+ section ‹Inductive predicates for lists›
4
+
5
+ datatype 'a list = Nil ("[]") | Cons 'a "'a list" ("_ # _")
6
+
7
+ fun length :: "'a list ⇒ nat" where
8
+ "length [] = 0" | "length (x # xs) = 1 + length xs"
9
+
10
+ inductive ζ :: "'a list ⇒ nat ⇒ bool" where
11
+ Nil[intro!]: "ζ [] 0" |
12
+ Cons[intro]: "ζ xs l ⟹ ζ (x # xs) (1 + l)"
13
+
14
+ (* Not the answer? *)
15
+ lemma "ζ xs 42"
16
+ oops
data/lib/rouge/demos/j ADDED
@@ -0,0 +1,12 @@
1
+ NB. Procedural programming
2
+ fizzbuzz=: monad define
3
+ for_i. >:i.y do.
4
+ if. 0 = 15 | i do. echo'FizzBuzz'
5
+ elseif. 0 = 3 | i do. echo'Fizz'
6
+ elseif. 0 = 5 | i do. echo'Buzz'
7
+ else. echo i
8
+ end.
9
+ end.
10
+ )
11
+ NB. Loopless programming
12
+ fizzbuzz=: echo@(, ::] ('Fizz' ; 'Buzz') ;@#~ 0 = 3 5&|)@>:@i.
@@ -0,0 +1,8 @@
1
+ open nat
2
+
3
+ def add : nat → nat → nat
4
+ | m zero := m
5
+ | m (succ n) := succ (add m n)
6
+
7
+ -- encode definition as an axiom
8
+ axiom add_zero (n : nat) : n + 0 = n
@@ -0,0 +1,10 @@
1
+ project('tutorial', 'c', version: '0.2.3')
2
+ executable('demo', 'main.c')
3
+
4
+ version_array = meson.project_version().split('.')
5
+ api_version = '@0@.@1@'.format(version_array[0], version_array[1])
6
+
7
+ d = dependency('foo', required : get_option('myfeature'))
8
+ if d.found()
9
+ app = executable('app', 'app.c', dependencies : [d])
10
+ endif
@@ -8,4 +8,4 @@ Reset:
8
8
  lda #$3f ; $3F -> A register
9
9
  ldy #$00 ; $00 -> Y register
10
10
  sta PPU_ADDR ; write #HIGH byte first
11
- sty PPU_ADDR ; $3F00 -> PPU address
11
+ sty PPU_ADDR ; $3F00 -> PPU address
@@ -0,0 +1,35 @@
1
+ % Functional Recursion: ;
2
+ fact IS RECUR [ 0 =, 1 first, pass, product, -1 +] % from wikipedia;
3
+
4
+ % Product of a range: ;
5
+ fact IS * count;
6
+
7
+ % Plain recursion: ;
8
+ fact IS OPERATION x {
9
+ if x = 0 then 1 else x * fact (x - 1) endif
10
+ };
11
+
12
+ % While loop: ;
13
+ fact IS OPERATION x {
14
+ prod := 1;
15
+ WHILE x > 0 DO
16
+ prod := prod * x;
17
+ x := x - 1;
18
+ ENDWHILE;
19
+ prod
20
+ }
21
+
22
+ % A basic divide by zero error: ;
23
+ 1 / 0
24
+ # OUTPUT:
25
+ ?div
26
+
27
+ % Errors are also values called faults, giving you their location: ;
28
+ 5 / 5 10 0 8
29
+ # OUTPUT:
30
+ 1. 0.5 ?div 0.625
31
+
32
+ % You can also define custom faults using 'fault': ;
33
+ fault 'this is an error'
34
+ # OUTPUT:
35
+ this is an error
@@ -0,0 +1,4 @@
1
+ context Compagnie::toEuros() : Collection(Real)
2
+ body: self.employees->collect(each: Employee| each.salary/ 6.55957)
3
+ -- OR
4
+ body: self.employees->collect(salary) -> collect(x | x/6.55957)
@@ -3,4 +3,3 @@ languagesystem DFLT dflt;
3
3
  feature liga {
4
4
  sub f i by f_i;
5
5
  } liga;
6
-
@@ -0,0 +1,2 @@
1
+ SELECT q'{a quoted string}' AS s, TO_CHAR(SYSDATE,'MM/DD/YYYY') AS "Current Date" FROM DUAL
2
+ WHERE 1=1;
@@ -0,0 +1,9 @@
1
+ %!PS
2
+ /Courier % name the desired font
3
+ 20 selectfont % choose the size in points and establish
4
+ % the font as the current one
5
+ 72 500 moveto % position the current point at
6
+ % coordinates 72, 500 (the origin is at the
7
+ % lower-left corner of the page)
8
+ (Hello world!) show % stroke the text in parentheses
9
+ showpage % print all on the page
@@ -0,0 +1,26 @@
1
+ module Person = {
2
+ type t = Teacher | Director | Student(string)
3
+
4
+ let greeting = person =>
5
+ switch person {
6
+ | Teacher => "Hey Professor!"
7
+ | Director => "Hello Director."
8
+ | Student("Richard") => "Still here Ricky?"
9
+ | Student(other) => "Hey, " ++ other ++ "."
10
+ }
11
+ }
12
+
13
+ module Button = {
14
+ @react.component
15
+ let make = (~count: int, ~onClick) => {
16
+ let times = switch count {
17
+ | 1 => "once"
18
+ | 2 => "twice"
19
+ | n => Belt.Int.toString(n) ++ " times"
20
+ }
21
+
22
+ let msg = "Click me " ++ times
23
+
24
+ <button onClick> {msg->React.string} </button>
25
+ }
26
+ }
@@ -9,4 +9,3 @@
9
9
  </ul>
10
10
 
11
11
  <div class="{if $foo}class1{else}class2{/if}">{$foo.bar.baz}</div>
12
-
@@ -0,0 +1,13 @@
1
+ data {
2
+ int<lower=0> N;
3
+ vector[N] x;
4
+ vector[N] y;
5
+ }
6
+ parameters {
7
+ real alpha;
8
+ real beta;
9
+ real<lower=0> sigma;
10
+ }
11
+ model {
12
+ y ~ normal(alpha + beta * x, sigma);
13
+ }
@@ -0,0 +1,14 @@
1
+ * Run a series of linear regressions
2
+ sysuse auto, clear
3
+ foreach v of varlist mpg weight-turn {
4
+ regress price `v', robust
5
+ }
6
+
7
+ regress price i.foreign
8
+ local num_obs = e(N)
9
+ global myglobal = 4
10
+
11
+ * Generate and manipulate variables
12
+ generate newvar1 = "string"
13
+ generate newvar2 = 34 - `num_obs'
14
+ replace newvar2 = $myglobal
@@ -0,0 +1,4 @@
1
+ [Unit]
2
+ Description=Snap Daemon
3
+ Requires=snapd.socket
4
+ OnFailure=snapd.failure.service
@@ -0,0 +1,15 @@
1
+ include <linux/test.h>
2
+
3
+ resource fd_test[fd]
4
+
5
+ openat$test(fd const[AT_FDCWD], file ptr[in, string["/dev/test"]], flags flags[open_flags], mode const[0]) fd_test
6
+
7
+ ioctl$TEST(fd fd_test, cmd const[TEST], arg ptr[in, test])
8
+
9
+ test {
10
+ number int32
11
+ size len[data, int32]
12
+ data array[int8]
13
+ }
14
+
15
+ _ = TEST
@@ -0,0 +1,8 @@
1
+ # Source: https://github.com/google/syzkaller/blob/master/sys/linux/test/vusb_hid
2
+
3
+ r0 = syz_usb_connect$hid(0x0, 0x36, &(0x7f0000000040)=ANY=[@ANYBLOB="12010000000018105e04da07000000000001090224000100000000090400000903000000092100000001222200090581030800000000"], 0x0)
4
+ syz_usb_control_io$hid(r0, 0x0, 0x0)
5
+ syz_usb_control_io$hid(r0, &(0x7f00000001c0)={0x24, 0x0, 0x0, &(0x7f0000000000)={0x0, 0x22, 0x22, {[@global=@item_012={0x2, 0x1, 0x9, "2313"}, @global=@item_012={0x2, 0x1, 0x0, "e53f"}, @global=@item_4={0x3, 0x1, 0x0, '\f\x00'}, @local=@item_012={0x2, 0x2, 0x2, "9000"}, @global=@item_4={0x3, 0x1, 0x0, "0900be00"}, @main=@item_4={0x3, 0x0, 0x8, '\x00'}, @local=@item_4={0x3, 0x2, 0x0, "09007a15"}, @local=@item_4={0x3, 0x2, 0x0, "5d8c3dda"}]}}, 0x0}, 0x0)
6
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
7
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
8
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
@@ -42,8 +42,8 @@ module Rouge
42
42
  end
43
43
 
44
44
  # Format a token stream. Delegates to {#format}.
45
- def self.format(tokens, *a, &b)
46
- new(*a).format(tokens, &b)
45
+ def self.format(tokens, *args, **kwargs, &b)
46
+ new(*args, **kwargs).format(tokens, &b)
47
47
  end
48
48
 
49
49
  def initialize(opts={})
@@ -28,4 +28,3 @@ module Rouge
28
28
  end
29
29
  end
30
30
  end
31
-
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Formatters
6
+ class HTMLLineHighlighter < Formatter
7
+ tag 'html_line_highlighter'
8
+
9
+ def initialize(delegate, opts = {})
10
+ @delegate = delegate
11
+ @highlight_line_class = opts.fetch(:highlight_line_class, 'hll')
12
+ @highlight_lines = opts[:highlight_lines] || []
13
+ end
14
+
15
+ def stream(tokens)
16
+ token_lines(tokens).with_index(1) do |line_tokens, lineno|
17
+ line = %(#{@delegate.format(line_tokens)}\n)
18
+ line = %(<span class="#{@highlight_line_class}">#{line}</span>) if @highlight_lines.include? lineno
19
+ yield line
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -32,10 +32,8 @@ module Rouge
32
32
  end
33
33
 
34
34
  def stream(tokens, &b)
35
- lineno = @start_line - 1
36
35
  buffer = [%(<table class="#@table_class"><tbody>)]
37
- token_lines(tokens) do |line_tokens|
38
- lineno += 1
36
+ token_lines(tokens).with_index(@start_line) do |line_tokens, lineno|
39
37
  buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
40
38
  buffer << %(<td class="#@gutter_class gl" )
41
39
  buffer << %(style="-moz-user-select: none;-ms-user-select: none;)
@@ -11,9 +11,8 @@ module Rouge
11
11
  end
12
12
 
13
13
  def stream(tokens, &b)
14
- lineno = 0
15
- token_lines(tokens) do |line_tokens|
16
- yield %(<#{@tag_name} class="#{sprintf @class_format, lineno += 1}">)
14
+ token_lines(tokens).with_index(1) do |line_tokens, lineno|
15
+ yield %(<#{@tag_name} class="#{sprintf @class_format, lineno}">)
17
16
  @formatter.stream(line_tokens) {|formatted| yield formatted }
18
17
  yield %(\n</#{@tag_name}>)
19
18
  end
@@ -131,6 +131,13 @@ module Rouge
131
131
  next TeX if matches?(/\A\s*(?:\\|%)/)
132
132
  next Apex
133
133
  end
134
+
135
+ disambiguate '*.pp' do
136
+ next Pascal if matches?(/\b(function|begin|var)\b/)
137
+ next Pascal if matches?(/\b(end(;|\.))/)
138
+
139
+ Puppet
140
+ end
134
141
  end
135
142
  end
136
143
  end