rouge 3.8.0 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge/demos/apex +9 -0
- data/lib/rouge/demos/clean +6 -0
- data/lib/rouge/demos/csvs +8 -0
- data/lib/rouge/demos/eex +1 -0
- data/lib/rouge/demos/haxe +5 -0
- data/lib/rouge/demos/hql +5 -0
- data/lib/rouge/demos/jsl +3 -0
- data/lib/rouge/demos/liquid +0 -1
- data/lib/rouge/demos/lustre +6 -0
- data/lib/rouge/demos/lutin +18 -0
- data/lib/rouge/demos/minizinc +23 -0
- data/lib/rouge/demos/robot_framework +27 -0
- data/lib/rouge/demos/sparql +6 -0
- data/lib/rouge/demos/terraform +0 -15
- data/lib/rouge/guessers/disambiguation.rb +5 -0
- data/lib/rouge/lexer.rb +3 -0
- data/lib/rouge/lexers/apex.rb +126 -0
- data/lib/rouge/lexers/clean.rb +156 -0
- data/lib/rouge/lexers/common_lisp.rb +1 -1
- data/lib/rouge/lexers/coq.rb +12 -9
- data/lib/rouge/lexers/csvs.rb +44 -0
- data/lib/rouge/lexers/eex.rb +52 -0
- data/lib/rouge/lexers/elixir.rb +20 -9
- data/lib/rouge/lexers/haxe.rb +246 -0
- data/lib/rouge/lexers/hql.rb +139 -0
- data/lib/rouge/lexers/http.rb +5 -5
- data/lib/rouge/lexers/javascript.rb +1 -1
- data/lib/rouge/lexers/jsl.rb +55 -0
- data/lib/rouge/lexers/json.rb +1 -1
- data/lib/rouge/lexers/kotlin.rb +21 -28
- data/lib/rouge/lexers/liquid.rb +82 -108
- data/lib/rouge/lexers/lustre.rb +79 -0
- data/lib/rouge/lexers/lutin.rb +33 -0
- data/lib/rouge/lexers/markdown.rb +7 -1
- data/lib/rouge/lexers/mason.rb +0 -5
- data/lib/rouge/lexers/matlab.rb +4 -2
- data/lib/rouge/lexers/matlab/builtins.yml +3515 -0
- data/lib/rouge/lexers/minizinc.rb +87 -0
- data/lib/rouge/lexers/perl.rb +1 -1
- data/lib/rouge/lexers/q.rb +1 -1
- data/lib/rouge/lexers/robot_framework.rb +249 -0
- data/lib/rouge/lexers/shell.rb +5 -3
- data/lib/rouge/lexers/sparql.rb +129 -0
- data/lib/rouge/lexers/sql.rb +26 -6
- data/lib/rouge/lexers/swift.rb +1 -1
- data/lib/rouge/lexers/terraform.rb +8 -0
- data/lib/rouge/plugins/redcarpet.rb +7 -1
- data/lib/rouge/version.rb +1 -1
- metadata +27 -3
- data/lib/rouge/lexers/matlab/builtins.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627bdb5578c0590a77e598473fcbe69330f21066cb87bd3463c2acabf31ac950
|
4
|
+
data.tar.gz: d28c6ae9d3a94d4cd81e1e7cd4ba883aa6a41d011569cd3051f140288bed70d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27fc73f1c40e471cb1120f6dab17700fb8155b1a4518c783374088725d35afe896a382e2ec2dd8690505bbe8eaf519396a4e5b4b6154816455b5865be7275244
|
7
|
+
data.tar.gz: 46e1d31f4df9486d498b8bc91b9fee28bfac7681b4acd276bbd084baf5a186ee2324c3fe16626f59df054e43e332b4fbb865115e7fb440b3acb4b3a6a0c0465e
|
data/lib/rouge/demos/eex
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<title><%= @title %></title>
|
data/lib/rouge/demos/hql
ADDED
data/lib/rouge/demos/jsl
ADDED
data/lib/rouge/demos/liquid
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
node gen_x_v1() returns (x:real) = loop 0.0<x and x<42.0
|
2
|
+
|
3
|
+
node gen_x_v2() returns (x:real) =
|
4
|
+
loop { 0.0<x and x<42.0 fby loop [20] x = pre x }
|
5
|
+
|
6
|
+
node gen_x_v3() returns (target:real; x:real=0.0) =
|
7
|
+
run target := gen_x_v2() in
|
8
|
+
loop { x = (pre x + target) / 2.0 }
|
9
|
+
|
10
|
+
let inertia=0.6
|
11
|
+
|
12
|
+
node gen_x_v4() returns (target:real; x:real=0.0) =
|
13
|
+
run target := gen_x_v2() in
|
14
|
+
exist px,ppx : real = 0.0 in
|
15
|
+
loop {
|
16
|
+
px = pre x and ppx = pre px and
|
17
|
+
x = (px+target) / 2.0+inertia*(px-ppx)
|
18
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
% from MiniZinc Handbook:
|
2
|
+
% https://www.minizinc.org/doc-latest/en/modelling.html
|
3
|
+
|
4
|
+
% Colouring Australia using nc colours
|
5
|
+
int: nc = 3;
|
6
|
+
|
7
|
+
var 1..nc: wa; var 1..nc: nt; var 1..nc: sa; var 1..nc: q;
|
8
|
+
var 1..nc: nsw; var 1..nc: v; var 1..nc: t;
|
9
|
+
|
10
|
+
constraint wa != nt;
|
11
|
+
constraint wa != sa;
|
12
|
+
constraint nt != sa;
|
13
|
+
constraint nt != q;
|
14
|
+
constraint sa != q;
|
15
|
+
constraint sa != nsw;
|
16
|
+
constraint sa != v;
|
17
|
+
constraint q != nsw;
|
18
|
+
constraint nsw != v;
|
19
|
+
solve satisfy;
|
20
|
+
|
21
|
+
output ["wa=\(wa)\t nt=\(nt)\t sa=\(sa)\n",
|
22
|
+
"q=\(q)\t nsw=\(nsw)\t v=\(v)\n",
|
23
|
+
"t=", show(t), "\n"];
|
@@ -0,0 +1,27 @@
|
|
1
|
+
*** Settings ***
|
2
|
+
Document Example taken from http://robotframework.org/
|
3
|
+
Suite Setup Open Browser To Login Page
|
4
|
+
Suite Teardown Close Browser
|
5
|
+
Test Setup Go To Login Page
|
6
|
+
Test Template Login With Invalid Credentials Should Fail
|
7
|
+
Resource resource.txt
|
8
|
+
|
9
|
+
*** Test Cases *** User Name Password
|
10
|
+
Invalid Username invalid ${VALID PASSWORD}
|
11
|
+
Invalid Password ${VALID USER} invalid
|
12
|
+
Invalid Username And Password invalid whatever
|
13
|
+
Empty Username ${EMPTY} ${VALID PASSWORD}
|
14
|
+
Empty Password ${VALID USER} ${EMPTY}
|
15
|
+
Empty Username And Password ${EMPTY} ${EMPTY}
|
16
|
+
|
17
|
+
*** Keywords ***
|
18
|
+
Login With Invalid Credentials Should Fail
|
19
|
+
[Arguments] ${username} ${password}
|
20
|
+
Input Username ${username}
|
21
|
+
Input Password ${password}
|
22
|
+
Submit Credentials
|
23
|
+
Login Should Have Failed
|
24
|
+
|
25
|
+
Login Should Have Failed
|
26
|
+
Location Should Be ${ERROR URL}
|
27
|
+
Title Should Be Error Page
|
data/lib/rouge/demos/terraform
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
# From: https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/count/main.tf
|
2
|
-
|
3
|
-
# Specify the provider and access details
|
4
|
-
provider "aws" {
|
5
|
-
region = "${var.aws_region}"
|
6
|
-
}
|
7
|
-
|
8
1
|
resource "aws_elb" "web" {
|
9
2
|
name = "terraform-example-elb"
|
10
3
|
|
@@ -21,11 +14,3 @@ resource "aws_elb" "web" {
|
|
21
14
|
# The instances are registered automatically
|
22
15
|
instances = ["${aws_instance.web.*.id}"]
|
23
16
|
}
|
24
|
-
|
25
|
-
resource "aws_instance" "web" {
|
26
|
-
instance_type = "m1.small"
|
27
|
-
ami = "${lookup(var.aws_amis, var.aws_region)}"
|
28
|
-
|
29
|
-
# This will create 4 instances
|
30
|
-
count = 4
|
31
|
-
}
|
data/lib/rouge/lexer.rb
CHANGED
@@ -49,6 +49,9 @@ module Rouge
|
|
49
49
|
#
|
50
50
|
# Lexer.find_fancy('guess', "#!/bin/bash\necho Hello, world")
|
51
51
|
#
|
52
|
+
# If the code matches more than one lexer then Guesser::Ambiguous
|
53
|
+
# is raised.
|
54
|
+
#
|
52
55
|
# This is used in the Redcarpet plugin as well as Rouge's own
|
53
56
|
# markdown lexer for highlighting internal code blocks.
|
54
57
|
#
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Apex < RegexLexer
|
7
|
+
title "Apex"
|
8
|
+
desc "The Apex programming language (provided by salesforce)"
|
9
|
+
|
10
|
+
tag 'apex'
|
11
|
+
filenames '*.cls'
|
12
|
+
mimetypes 'text/x-apex'
|
13
|
+
|
14
|
+
def self.keywords
|
15
|
+
@keywords ||= Set.new %w(
|
16
|
+
assert break case catch continue default do else finally for if goto
|
17
|
+
instanceof new return switch this throw try while insert update
|
18
|
+
delete
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.declarations
|
23
|
+
@declarations ||= Set.new %w(
|
24
|
+
abstract const enum extends final implements native private protected
|
25
|
+
public static super synchronized throws transient volatile with
|
26
|
+
sharing without inherited virtual global testmethod
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.soql
|
31
|
+
@soql ||= Set.new %w(
|
32
|
+
SELECT FROM WHERE UPDATE LIKE TYPEOF END USING SCOPE WITH DATA
|
33
|
+
CATEGORY GROUP BY ROLLUP CUBE HAVING ORDER BY ASC DESC NULLS FIRST
|
34
|
+
LAST LIMIT OFFSET FOR VIEW REFERENCE UPDATE TRACKING VIEWSTAT OR AND
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.types
|
39
|
+
@types ||= Set.new %w(
|
40
|
+
String boolean byte char double float int long short var void
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.constants
|
45
|
+
@constants ||= Set.new %w(true false null)
|
46
|
+
end
|
47
|
+
|
48
|
+
id = /[a-z_][a-z0-9_]*/i
|
49
|
+
|
50
|
+
state :root do
|
51
|
+
rule %r/\s+/m, Text
|
52
|
+
|
53
|
+
rule %r(//.*?$), Comment::Single
|
54
|
+
rule %r(/\*.*?\*/)m, Comment::Multiline
|
55
|
+
|
56
|
+
rule %r/(?:class|interface)\b/, Keyword::Declaration, :class
|
57
|
+
rule %r/import\b/, Keyword::Namespace, :import
|
58
|
+
|
59
|
+
rule %r/([@$.]?)(#{id})([:(]?)/io do |m|
|
60
|
+
if self.class.keywords.include? m[0].downcase
|
61
|
+
token Keyword
|
62
|
+
elsif self.class.soql.include? m[0].upcase
|
63
|
+
token Keyword
|
64
|
+
elsif self.class.declarations.include? m[0].downcase
|
65
|
+
token Keyword::Declaration
|
66
|
+
elsif self.class.types.include? m[0].downcase
|
67
|
+
token Keyword::Type
|
68
|
+
elsif self.class.constants.include? m[0].downcase
|
69
|
+
token Keyword::Constant
|
70
|
+
elsif 'package'.casecmp m[0]
|
71
|
+
token Keyword::Namespace
|
72
|
+
elsif m[1] == "@"
|
73
|
+
token Name::Decorator
|
74
|
+
elsif m[3] == ":"
|
75
|
+
groups Operator, Name::Label, Punctuation
|
76
|
+
elsif m[3] == "("
|
77
|
+
groups Operator, Name::Function, Punctuation
|
78
|
+
elsif m[1] == "."
|
79
|
+
groups Operator, Name::Property, Punctuation
|
80
|
+
else
|
81
|
+
token Name
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
rule %r/"/, Str::Double, :dq
|
86
|
+
rule %r/'/, Str::Single, :sq
|
87
|
+
|
88
|
+
digit = /[0-9]_+[0-9]|[0-9]/
|
89
|
+
rule %r/#{digit}+\.#{digit}+([eE]#{digit}+)?[fd]?/, Num::Float
|
90
|
+
rule %r/0b(?:[01]_+[01]|[01])+/i, Num::Bin
|
91
|
+
rule %r/0x(?:\h_+\h|\h)+/i, Num::Hex
|
92
|
+
rule %r/0(?:[0-7]_+[0-7]|[0-7])+/, Num::Oct
|
93
|
+
rule %r/#{digit}+L?/, Num::Integer
|
94
|
+
|
95
|
+
rule %r/[-+\/*~^!%&<>|=.?]/, Operator
|
96
|
+
rule %r/[\[\](){},:;]/, Punctuation;
|
97
|
+
end
|
98
|
+
|
99
|
+
state :class do
|
100
|
+
rule %r/\s+/m, Text
|
101
|
+
rule id, Name::Class, :pop!
|
102
|
+
end
|
103
|
+
|
104
|
+
state :import do
|
105
|
+
rule %r/\s+/m, Text
|
106
|
+
rule %r/[a-z0-9_.]+\*?/i, Name::Namespace, :pop!
|
107
|
+
end
|
108
|
+
|
109
|
+
state :escape do
|
110
|
+
rule %r/\\[btnfr\\"']/, Str::Escape
|
111
|
+
end
|
112
|
+
|
113
|
+
state :dq do
|
114
|
+
mixin :escape
|
115
|
+
rule %r/[^\\"]+/, Str::Double
|
116
|
+
rule %r/"/, Str::Double, :pop!
|
117
|
+
end
|
118
|
+
|
119
|
+
state :sq do
|
120
|
+
mixin :escape
|
121
|
+
rule %r/[^\\']+/, Str::Double
|
122
|
+
rule %r/'/, Str::Double, :pop!
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Clean < RegexLexer
|
7
|
+
title "Clean"
|
8
|
+
desc "The Clean programming language (clean.cs.ru.nl)"
|
9
|
+
|
10
|
+
tag 'clean'
|
11
|
+
filenames '*.dcl', '*.icl'
|
12
|
+
|
13
|
+
def self.keywords
|
14
|
+
@keywords ||= Set.new %w(
|
15
|
+
if otherwise
|
16
|
+
let in
|
17
|
+
with where
|
18
|
+
case of
|
19
|
+
infix infixl infixr
|
20
|
+
class instance
|
21
|
+
generic derive
|
22
|
+
special
|
23
|
+
implementation definition system module
|
24
|
+
from import qualified as
|
25
|
+
dynamic
|
26
|
+
code inline foreign export ccall stdcall
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
# These are literal patterns common to the ABC intermediate language and
|
31
|
+
# Clean. Clean has more extensive literal patterns (see :basic below).
|
32
|
+
state :common_literals do
|
33
|
+
rule %r/'(?:[^'\\]|\\(?:x[0-9a-fA-F]+|\d+|.))'/, Str::Char
|
34
|
+
|
35
|
+
rule %r/[+~-]?\d+\.\d+(?:E[+-]?\d+)?\b/, Num::Float
|
36
|
+
rule %r/[+~-]?\d+E[+-]?\d+\b/, Num::Float
|
37
|
+
rule %r/[+~-]?\d+/, Num::Integer
|
38
|
+
|
39
|
+
rule %r/"/, Str::Double, :string
|
40
|
+
end
|
41
|
+
|
42
|
+
state :basic do
|
43
|
+
rule %r/\s+/m, Text::Whitespace
|
44
|
+
|
45
|
+
rule %r/\/\/\*.*/, Comment::Doc
|
46
|
+
rule %r/\/\/.*/, Comment::Single
|
47
|
+
rule %r/\/\*\*/, Comment::Doc, :comment_doc
|
48
|
+
rule %r/\/\*/, Comment::Multiline, :comment
|
49
|
+
|
50
|
+
rule %r/[+~-]?0[0-7]+/, Num::Oct
|
51
|
+
rule %r/[+~-]?0x[0-9a-fA-F]+/, Num::Hex
|
52
|
+
mixin :common_literals
|
53
|
+
rule %r/(\[)(\s*)(')(?=.*?'\])/ do
|
54
|
+
groups Punctuation, Text::Whitespace, Str::Single, Punctuation
|
55
|
+
push :charlist
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# nested commenting
|
60
|
+
state :comment_doc do
|
61
|
+
rule %r/\*\//, Comment::Doc, :pop!
|
62
|
+
rule %r/\/\/.*/, Comment::Doc # Singleline comments in multiline comments are skipped
|
63
|
+
rule %r/\/\*/, Comment::Doc, :comment
|
64
|
+
rule %r/[^*\/]+/, Comment::Doc
|
65
|
+
rule %r/[*\/]/, Comment::Doc
|
66
|
+
end
|
67
|
+
|
68
|
+
# This is the same as the above, but with Multiline instead of Doc
|
69
|
+
state :comment do
|
70
|
+
rule %r/\*\//, Comment::Multiline, :pop!
|
71
|
+
rule %r/\/\/.*/, Comment::Multiline # Singleline comments in multiline comments are skipped
|
72
|
+
rule %r/\/\*/, Comment::Multiline, :comment
|
73
|
+
rule %r/[^*\/]+/, Comment::Multiline
|
74
|
+
rule %r/[*\/]/, Comment::Multiline
|
75
|
+
end
|
76
|
+
|
77
|
+
state :root do
|
78
|
+
mixin :basic
|
79
|
+
|
80
|
+
rule %r/code(\s+inline)?\s*{/, Comment::Preproc, :abc
|
81
|
+
|
82
|
+
rule %r/_*[a-z][\w_`]*/ do |m|
|
83
|
+
if self.class.keywords.include?(m[0])
|
84
|
+
token Keyword
|
85
|
+
else
|
86
|
+
token Name
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
rule %r/_*[A-Z][\w_`]*/ do |m|
|
91
|
+
if m[0]=='True' || m[0]=='False'
|
92
|
+
token Keyword::Constant
|
93
|
+
else
|
94
|
+
token Keyword::Type
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
rule %r/[^\w_\s`]/, Punctuation
|
99
|
+
rule %r/_\b/, Punctuation
|
100
|
+
end
|
101
|
+
|
102
|
+
state :escapes do
|
103
|
+
rule %r/\\x[0-9a-fA-F]{1,2}/i, Str::Escape
|
104
|
+
rule %r/\\d\d{0,3}/i, Str::Escape
|
105
|
+
rule %r/\\0[0-7]{0,3}/, Str::Escape
|
106
|
+
rule %r/\\[0-7]{1,3}/, Str::Escape
|
107
|
+
rule %r/\\[nrfbtv\\"']/, Str::Escape
|
108
|
+
end
|
109
|
+
|
110
|
+
state :string do
|
111
|
+
rule %r/"/, Str::Double, :pop!
|
112
|
+
mixin :escapes
|
113
|
+
rule %r/[^\\"]+/, Str::Double
|
114
|
+
end
|
115
|
+
|
116
|
+
state :charlist do
|
117
|
+
rule %r/(')(\])/ do
|
118
|
+
groups Str::Single, Punctuation
|
119
|
+
pop!
|
120
|
+
end
|
121
|
+
mixin :escapes
|
122
|
+
rule %r/[^\\']/, Str::Single
|
123
|
+
end
|
124
|
+
|
125
|
+
state :abc_basic do
|
126
|
+
rule %r/\s+/, Text::Whitespace
|
127
|
+
rule %r/\|.*/, Comment::Single
|
128
|
+
mixin :common_literals
|
129
|
+
end
|
130
|
+
|
131
|
+
# The ABC intermediate language can be included, similar to C's inline
|
132
|
+
# assembly. For some information about ABC, see:
|
133
|
+
# https://en.wikipedia.org/wiki/Clean_(programming_language)#The_ABC-Machine
|
134
|
+
state :abc do
|
135
|
+
mixin :abc_basic
|
136
|
+
|
137
|
+
rule %r/}/, Comment::Preproc, :pop!
|
138
|
+
rule %r/\.\w*/, Keyword, :abc_rest_of_line
|
139
|
+
rule %r/[\w_]+/, Name::Builtin, :abc_rest_of_line
|
140
|
+
end
|
141
|
+
|
142
|
+
state :abc_rest_of_line do
|
143
|
+
rule %r/\n/, Text::Whitespace, :pop!
|
144
|
+
rule %r/}/ do
|
145
|
+
token Comment::Preproc
|
146
|
+
pop!
|
147
|
+
pop!
|
148
|
+
end
|
149
|
+
|
150
|
+
mixin :abc_basic
|
151
|
+
|
152
|
+
rule %r/\S+/, Name
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|