rouge 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rouge/cli.rb +1 -1
- data/lib/rouge/demos/actionscript +4 -0
- data/lib/rouge/demos/apiblueprint +33 -0
- data/lib/rouge/demos/biml +38 -0
- data/lib/rouge/demos/ceylon +7 -0
- data/lib/rouge/demos/cmake +7 -0
- data/lib/rouge/demos/coq +11 -0
- data/lib/rouge/demos/d +16 -0
- data/lib/rouge/demos/eiffel +30 -0
- data/lib/rouge/demos/fortran +22 -0
- data/lib/rouge/demos/gradle +10 -0
- data/lib/rouge/demos/jinja +9 -0
- data/lib/rouge/demos/jsonnet +28 -0
- data/lib/rouge/demos/julia +11 -0
- data/lib/rouge/demos/nasm +26 -0
- data/lib/rouge/demos/objective_c +4 -0
- data/lib/rouge/demos/protobuf +5 -0
- data/lib/rouge/demos/shell_session +10 -0
- data/lib/rouge/demos/smarty +12 -0
- data/lib/rouge/demos/tap +5 -0
- data/lib/rouge/demos/twig +9 -0
- data/lib/rouge/demos/typescript +1 -0
- data/lib/rouge/demos/verilog +27 -0
- data/lib/rouge/demos/viml +14 -5
- data/lib/rouge/formatters/html_wrapper.rb +11 -0
- data/lib/rouge/formatters/terminal256.rb +1 -1
- data/lib/rouge/lexer.rb +4 -2
- data/lib/rouge/lexers/actionscript.rb +195 -0
- data/lib/rouge/lexers/apache.rb +23 -20
- data/lib/rouge/lexers/apache/keywords.yml +721 -410
- data/lib/rouge/lexers/apiblueprint.rb +51 -0
- data/lib/rouge/lexers/biml.rb +41 -0
- data/lib/rouge/lexers/c.rb +7 -2
- data/lib/rouge/lexers/ceylon.rb +123 -0
- data/lib/rouge/lexers/clojure.rb +1 -1
- data/lib/rouge/lexers/cmake.rb +206 -0
- data/lib/rouge/lexers/coffeescript.rb +1 -1
- data/lib/rouge/lexers/coq.rb +187 -0
- data/lib/rouge/lexers/cpp.rb +12 -1
- data/lib/rouge/lexers/csharp.rb +12 -5
- data/lib/rouge/lexers/css.rb +2 -0
- data/lib/rouge/lexers/d.rb +176 -0
- data/lib/rouge/lexers/diff.rb +9 -9
- data/lib/rouge/lexers/eiffel.rb +65 -0
- data/lib/rouge/lexers/fortran.rb +142 -0
- data/lib/rouge/lexers/gradle.rb +37 -0
- data/lib/rouge/lexers/groovy.rb +2 -2
- data/lib/rouge/lexers/ini.rb +2 -2
- data/lib/rouge/lexers/java.rb +11 -8
- data/lib/rouge/lexers/javascript.rb +2 -1
- data/lib/rouge/lexers/jinja.rb +137 -0
- data/lib/rouge/lexers/jsonnet.rb +151 -0
- data/lib/rouge/lexers/julia.rb +172 -0
- data/lib/rouge/lexers/markdown.rb +1 -0
- data/lib/rouge/lexers/nasm.rb +203 -0
- data/lib/rouge/lexers/objective_c.rb +11 -0
- data/lib/rouge/lexers/php.rb +1 -1
- data/lib/rouge/lexers/powershell.rb +1 -1
- data/lib/rouge/lexers/protobuf.rb +70 -0
- data/lib/rouge/lexers/python.rb +23 -0
- data/lib/rouge/lexers/r.rb +53 -20
- data/lib/rouge/lexers/ruby.rb +4 -4
- data/lib/rouge/lexers/rust.rb +2 -2
- data/lib/rouge/lexers/shell_session.rb +29 -0
- data/lib/rouge/lexers/smarty.rb +91 -0
- data/lib/rouge/lexers/sql.rb +1 -1
- data/lib/rouge/lexers/swift.rb +20 -5
- data/lib/rouge/lexers/tap.rb +91 -0
- data/lib/rouge/lexers/twig.rb +37 -0
- data/lib/rouge/lexers/typescript.rb +46 -0
- data/lib/rouge/lexers/verilog.rb +164 -0
- data/lib/rouge/regex_lexer.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- data/rouge.gemspec +1 -1
- metadata +47 -6
- data/lib/rouge/formatters/html_inline.rb +0 -20
- data/lib/rouge/formatters/html_linewise.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d52689800e9b41571b3c09b3412f672a0e96de8
|
4
|
+
data.tar.gz: f0b4629db72f7122e8ff0760487f9193edec8f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7d9859a295ad5e9e269eecf77e3477d3bf93b062f19e0095b81135e66265375ddbfb1c986a155a4ed84921366ce2914e0ee900040c24f58d488921417a8928
|
7
|
+
data.tar.gz: b4de6ef45285cf75dac6d9558341955e5c29b30f06ea6a7584c99b1febde9a63915fa2a5442839fa3c7cc51da57dd51a2152adcfb98f09e83abba0524e11c359
|
data/lib/rouge/cli.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
FORMAT: 1A
|
2
|
+
HOST: http://polls.apiblueprint.org/
|
3
|
+
|
4
|
+
# Polls
|
5
|
+
|
6
|
+
Polls is a simple API allowing consumers to view polls and vote in them.
|
7
|
+
|
8
|
+
# Polls API Root [/]
|
9
|
+
|
10
|
+
## Group Question
|
11
|
+
|
12
|
+
Resources related to questions in the API.
|
13
|
+
|
14
|
+
## Question [/questions/{question_id}]
|
15
|
+
|
16
|
+
+ Parameters
|
17
|
+
+ question_id: 1 (number, required) - ID of the Question in form of an integer
|
18
|
+
|
19
|
+
+ Attributes
|
20
|
+
+ question: `Favourite programming language?` (required)
|
21
|
+
+ published_at: `2014-11-11T08:40:51.620Z` - An ISO8601 date when the question was published
|
22
|
+
+ choices (array[Choice], required) - An array of Choice objects
|
23
|
+
+ url: /questions/1
|
24
|
+
|
25
|
+
### View a Questions Detail [GET]
|
26
|
+
|
27
|
+
+ Response 200 (application/json)
|
28
|
+
+ Attributes (Question)
|
29
|
+
|
30
|
+
### Delete a Question [DELETE]
|
31
|
+
|
32
|
+
+ Relation: delete
|
33
|
+
+ Response 204
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<#@ template language="C#" #>
|
2
|
+
<#@ import namespace="System.Data" #>
|
3
|
+
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
|
4
|
+
<Connections>
|
5
|
+
<!-- Creates a connection to the Adventure Works database -->
|
6
|
+
<Connection
|
7
|
+
Name="AdventureWorks"
|
8
|
+
ConnectionString="Provider=SQLNCLI10.1;Data Source=Localhost;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=AdventureWorksDW"
|
9
|
+
/>
|
10
|
+
</Connections>
|
11
|
+
<!-- Packages Collection -->
|
12
|
+
<Packages>
|
13
|
+
<!-- A Package -->
|
14
|
+
<Package
|
15
|
+
Name="MyFirstPackage"
|
16
|
+
ConstraintMode="Linear"
|
17
|
+
>
|
18
|
+
<!-- A Package's Tasks -->
|
19
|
+
<Tasks>
|
20
|
+
<ExecuteSQL Name="ExecuteStoredProc" ConnectionName="AdventureWorks">
|
21
|
+
<DirectInput>EXEC usp_StoredProc</DirectInput>
|
22
|
+
</ExecuteSQL>
|
23
|
+
<# foreach (var table in RootNode.Tables) { #>
|
24
|
+
<Dataflow Name="Duplicate <#=table.Name#> Data">
|
25
|
+
<Transformations>
|
26
|
+
<OleDbSource Name="Retrieve Data" ConnectionName="AdventureWorks">
|
27
|
+
<DirectInput>SELECT * FROM <#=table.Name#></DirectInput>
|
28
|
+
</OleDbSource>
|
29
|
+
<OleDbDestination Name="Insert Data" ConnectionName="AdventureWorks">
|
30
|
+
<ExternalTableOutput Table="<#=table.Name#>" />
|
31
|
+
</OleDbDestination>
|
32
|
+
</Transformations>
|
33
|
+
</Dataflow>
|
34
|
+
<# } #>
|
35
|
+
</Tasks>
|
36
|
+
</Package>
|
37
|
+
</Packages>
|
38
|
+
</Biml>
|
data/lib/rouge/demos/coq
ADDED
data/lib/rouge/demos/d
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import std.algorithm, std.conv, std.functional,
|
2
|
+
std.math, std.regex, std.stdio;
|
3
|
+
|
4
|
+
alias round = pipe!(to!real, std.math.round, to!string);
|
5
|
+
static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;
|
6
|
+
|
7
|
+
void main()
|
8
|
+
{
|
9
|
+
// Replace anything that looks like a real
|
10
|
+
// number with the rounded equivalent.
|
11
|
+
stdin
|
12
|
+
.byLine
|
13
|
+
.map!(l => l.replaceAll!(c => c.hit.round)
|
14
|
+
(reFloatingPoint))
|
15
|
+
.each!writeln;
|
16
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
note
|
2
|
+
description: "Represents a person."
|
3
|
+
|
4
|
+
class
|
5
|
+
PERSON
|
6
|
+
|
7
|
+
create
|
8
|
+
make, make_unknown
|
9
|
+
|
10
|
+
feature {NONE} -- Creation
|
11
|
+
|
12
|
+
make (a_name: like name)
|
13
|
+
-- Create a person with `a_name' as `name'.
|
14
|
+
do
|
15
|
+
name := a_name
|
16
|
+
ensure
|
17
|
+
name = a_name
|
18
|
+
end
|
19
|
+
|
20
|
+
make_unknown
|
21
|
+
do ensure
|
22
|
+
name = Void
|
23
|
+
end
|
24
|
+
|
25
|
+
feature -- Access
|
26
|
+
|
27
|
+
name: detachable STRING
|
28
|
+
-- Full name or Void if unknown.
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
program bottles
|
2
|
+
|
3
|
+
implicit none
|
4
|
+
integer :: nbottles
|
5
|
+
|
6
|
+
do nbottles = 99, 1, -1
|
7
|
+
call print_bottles(nbottles)
|
8
|
+
end do
|
9
|
+
|
10
|
+
contains
|
11
|
+
|
12
|
+
subroutine print_bottles(n)
|
13
|
+
implicit none
|
14
|
+
integer, intent(in) :: n
|
15
|
+
|
16
|
+
write(*, "(I0, 1X, 'bottles of beer on the wall,')") n
|
17
|
+
write(*, "(I0, 1X, 'bottles of beer.')") n
|
18
|
+
write(*, "('Take one down, pass it around,')")
|
19
|
+
write(*, "(I0, 1X, 'bottles of beer on the wall.', /)") n - 1
|
20
|
+
end subroutine print_bottles
|
21
|
+
|
22
|
+
end program bottles
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// Compiler template
|
2
|
+
local CCompiler = {
|
3
|
+
cFlags: [],
|
4
|
+
out: "a.out",
|
5
|
+
local flags_str = std.join(" ", self.cFlags),
|
6
|
+
local files_str = std.join(" ", self.files),
|
7
|
+
cmd: "%s %s %s -o %s" % [self.compiler, flags_str, files_str, self.out],
|
8
|
+
};
|
9
|
+
|
10
|
+
// GCC specialization
|
11
|
+
local Gcc = CCompiler { compiler: "gcc" };
|
12
|
+
|
13
|
+
// Another specialization
|
14
|
+
local Clang = CCompiler { compiler: "clang" };
|
15
|
+
|
16
|
+
// Mixins - append flags
|
17
|
+
local Opt = { cFlags: super.cFlags + ["-O3", "-DNDEBUG"] };
|
18
|
+
local Dbg = { cFlags: super.cFlags + ["-g"] };
|
19
|
+
|
20
|
+
// Output:
|
21
|
+
{
|
22
|
+
targets: [
|
23
|
+
Gcc { files: ["a.c", "b.c"] },
|
24
|
+
Clang { files: ["test.c"], out: "test" },
|
25
|
+
Clang + Opt { files: ["test2.c"], out: "test2" },
|
26
|
+
Gcc + Opt + Dbg { files: ["foo.c", "bar.c"], out: "baz" },
|
27
|
+
]
|
28
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
%macro IRQ 2
|
2
|
+
global irq%1
|
3
|
+
irq%1:
|
4
|
+
cli
|
5
|
+
push byte 0 ; push a dummy error code
|
6
|
+
push byte %2 ; push the IRQ number
|
7
|
+
jmp irq_common_stub
|
8
|
+
%endmacro
|
9
|
+
|
10
|
+
extern irq_handler
|
11
|
+
|
12
|
+
irq_common_stub:
|
13
|
+
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
|
14
|
+
mov ax, ds ; Lower 16-bits of eax = ds.
|
15
|
+
push eax ; save the data segment descriptor
|
16
|
+
mov ax, 0x10 ; load the kernel data segment descriptor
|
17
|
+
mov edx, eax
|
18
|
+
call irq_handler
|
19
|
+
|
20
|
+
%assign i 0
|
21
|
+
%rep 8
|
22
|
+
ISR_NOERRCODE i
|
23
|
+
%assign i i+1
|
24
|
+
%endrep
|
25
|
+
|
26
|
+
ISR_NOERRCODE 9
|
data/lib/rouge/demos/objective_c
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
{foo bar='single quotes' baz="double quotes" test3=$test3}
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
{foreach from=$myvariable item=data}
|
5
|
+
<li>{$data.field}</li>
|
6
|
+
{foreachelse}
|
7
|
+
<li>No Data</li>
|
8
|
+
{/foreach}
|
9
|
+
</ul>
|
10
|
+
|
11
|
+
<div class="{if $foo}class1{else}class2{/if}">{$foo.bar.baz}</div>
|
12
|
+
|
data/lib/rouge/demos/tap
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$(document).ready(function() { alert('ready!'); });
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Verilog Lexer
|
3
|
+
*/
|
4
|
+
module Foo(
|
5
|
+
input logic Clk_CI,
|
6
|
+
input logic Rst_RBI,
|
7
|
+
input logic A,
|
8
|
+
input logic B,
|
9
|
+
output logic C
|
10
|
+
);
|
11
|
+
logic C_DN, C_DP;
|
12
|
+
|
13
|
+
assign C = C_DP;
|
14
|
+
|
15
|
+
always_comb begin : proc_next_state
|
16
|
+
C_DN = A + B;
|
17
|
+
end
|
18
|
+
|
19
|
+
// Clocked process
|
20
|
+
always_ff @(posedge Clk_CI, negedge Rst_RBI) begin
|
21
|
+
if(~Rst_RBI) begin
|
22
|
+
C_DP <= 1'b0;
|
23
|
+
end else begin
|
24
|
+
C_DP <= C_DN;
|
25
|
+
end
|
26
|
+
end
|
27
|
+
endmodule
|
data/lib/rouge/demos/viml
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
function! s:Make(dir, make, format, name) abort
|
2
|
+
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
|
3
|
+
let cwd = getcwd()
|
4
|
+
let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')]
|
5
|
+
try
|
6
|
+
execute cd fnameescape(dir)
|
7
|
+
let [&l:mp, &l:efm, b:current_compiler] = [a:make, a:format, a:compiler]
|
8
|
+
execute (exists(':Make') == 2 ? 'Make' : 'make')
|
9
|
+
finally
|
10
|
+
let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc]
|
11
|
+
if empty(cc) | unlet! b:current_compiler | endif
|
12
|
+
execute cd fnameescape(cwd)
|
13
|
+
endtry
|
14
|
+
endfunction
|
data/lib/rouge/lexer.rb
CHANGED
@@ -124,9 +124,11 @@ module Rouge
|
|
124
124
|
# the analysis more.
|
125
125
|
source_threshold = lexers.size < total_size ? 0 : 0.5
|
126
126
|
return [best_by_source(lexers, source, source_threshold)].compact
|
127
|
+
elsif lexers.size < total_size
|
128
|
+
return lexers
|
129
|
+
else
|
130
|
+
return []
|
127
131
|
end
|
128
|
-
|
129
|
-
[]
|
130
132
|
end
|
131
133
|
|
132
134
|
class AmbiguousGuess < StandardError
|