rouge 3.8.0 → 3.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rouge/demos/apex +9 -0
  3. data/lib/rouge/demos/clean +6 -0
  4. data/lib/rouge/demos/csvs +8 -0
  5. data/lib/rouge/demos/eex +1 -0
  6. data/lib/rouge/demos/haxe +5 -0
  7. data/lib/rouge/demos/hql +5 -0
  8. data/lib/rouge/demos/jsl +3 -0
  9. data/lib/rouge/demos/liquid +0 -1
  10. data/lib/rouge/demos/lustre +6 -0
  11. data/lib/rouge/demos/lutin +18 -0
  12. data/lib/rouge/demos/minizinc +23 -0
  13. data/lib/rouge/demos/robot_framework +27 -0
  14. data/lib/rouge/demos/sparql +6 -0
  15. data/lib/rouge/demos/terraform +0 -15
  16. data/lib/rouge/guessers/disambiguation.rb +5 -0
  17. data/lib/rouge/lexer.rb +3 -0
  18. data/lib/rouge/lexers/apex.rb +126 -0
  19. data/lib/rouge/lexers/clean.rb +156 -0
  20. data/lib/rouge/lexers/common_lisp.rb +1 -1
  21. data/lib/rouge/lexers/coq.rb +12 -9
  22. data/lib/rouge/lexers/csvs.rb +44 -0
  23. data/lib/rouge/lexers/eex.rb +52 -0
  24. data/lib/rouge/lexers/elixir.rb +20 -9
  25. data/lib/rouge/lexers/haxe.rb +246 -0
  26. data/lib/rouge/lexers/hql.rb +139 -0
  27. data/lib/rouge/lexers/http.rb +5 -5
  28. data/lib/rouge/lexers/javascript.rb +1 -1
  29. data/lib/rouge/lexers/jsl.rb +55 -0
  30. data/lib/rouge/lexers/json.rb +1 -1
  31. data/lib/rouge/lexers/kotlin.rb +21 -28
  32. data/lib/rouge/lexers/liquid.rb +82 -108
  33. data/lib/rouge/lexers/lustre.rb +79 -0
  34. data/lib/rouge/lexers/lutin.rb +33 -0
  35. data/lib/rouge/lexers/markdown.rb +7 -1
  36. data/lib/rouge/lexers/mason.rb +0 -5
  37. data/lib/rouge/lexers/matlab.rb +4 -2
  38. data/lib/rouge/lexers/matlab/builtins.yml +3515 -0
  39. data/lib/rouge/lexers/minizinc.rb +87 -0
  40. data/lib/rouge/lexers/perl.rb +1 -1
  41. data/lib/rouge/lexers/q.rb +1 -1
  42. data/lib/rouge/lexers/robot_framework.rb +249 -0
  43. data/lib/rouge/lexers/shell.rb +5 -3
  44. data/lib/rouge/lexers/sparql.rb +129 -0
  45. data/lib/rouge/lexers/sql.rb +26 -6
  46. data/lib/rouge/lexers/swift.rb +1 -1
  47. data/lib/rouge/lexers/terraform.rb +8 -0
  48. data/lib/rouge/plugins/redcarpet.rb +7 -1
  49. data/lib/rouge/version.rb +1 -1
  50. metadata +27 -3
  51. data/lib/rouge/lexers/matlab/builtins.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4041f8ac950b427b35d8d3147b6d9aed3743655daaaf09f57d303932b11259a6
4
- data.tar.gz: cddd94af18b0f7ba578fa4c57f75415233d5518095b29202a7c12afd2662b804
3
+ metadata.gz: 627bdb5578c0590a77e598473fcbe69330f21066cb87bd3463c2acabf31ac950
4
+ data.tar.gz: d28c6ae9d3a94d4cd81e1e7cd4ba883aa6a41d011569cd3051f140288bed70d8
5
5
  SHA512:
6
- metadata.gz: 68b649f1f965e5cd21fd722263bdff8720ba04119b8fff2245bb9c4178648d255362c3a18129c6724dd56893f777a518d1ff74ade223697530f5a6595d20f2aa
7
- data.tar.gz: 182df2ef3e868eb95132022309db218e34f2cd19e9e874a7d119f6250db0971e7ba6fd28ddea2ebfa8fdb759504dfe8a8401e085e95386748c7a00de347fc5d9
6
+ metadata.gz: 27fc73f1c40e471cb1120f6dab17700fb8155b1a4518c783374088725d35afe896a382e2ec2dd8690505bbe8eaf519396a4e5b4b6154816455b5865be7275244
7
+ data.tar.gz: 46e1d31f4df9486d498b8bc91b9fee28bfac7681b4acd276bbd084baf5a186ee2324c3fe16626f59df054e43e332b4fbb865115e7fb440b3acb4b3a6a0c0465e
@@ -0,0 +1,9 @@
1
+ public class with sharing Trigger {
2
+ @Deprecated
3
+ public void resolveSum(int x, int y) {
4
+ System.debug('x is ' + x);
5
+ System.debug('y is ' + y);
6
+
7
+ System.debug('x + y = ' + (x+y));
8
+ }
9
+ }
@@ -0,0 +1,6 @@
1
+ delete :: !a !.(Set a) -> Set a | < a
2
+ delete x Tip = Tip
3
+ delete x (Bin _ y l r)
4
+ | x < y = balanceR y (delete x l) r
5
+ | x > y = balanceL y l (delete x r)
6
+ | otherwise = glue l r
@@ -0,0 +1,8 @@
1
+ version 1.1
2
+ @totalColumns 5
3
+ @separator ','
4
+ Transaction_Date: xDate
5
+ Transaction_ID: notEmpty
6
+ Originator_Name: notEmpty
7
+ Originator_Address: any("yes","no")
8
+ Originator_Country: notEmpty
@@ -0,0 +1 @@
1
+ <title><%= @title %></title>
@@ -0,0 +1,5 @@
1
+ // hello world!
2
+ public static function hello(arg : String) {
3
+ return 'Hello $arg';
4
+ }
5
+
@@ -0,0 +1,5 @@
1
+ SELECT e.first_name, e.last_name, d.department_name
2
+ FROM employees e
3
+ JOIN departments d ON e.department_id = d.department_id;
4
+
5
+ update `table` set name='abc', date=${date}, test_interpolation="${var1}.${var2}" where xyz is null;
@@ -0,0 +1,3 @@
1
+ // Create Distribution of Big Class
2
+ dt = open( "$sample_data\big class.jmp" );
3
+ dt << Distribution( Column( :age ), Histograms Only( 1 ) );
@@ -5,7 +5,6 @@
5
5
  Only {{ product.price | format_as_money }}
6
6
 
7
7
  <p>{{ product.description | prettyprint | truncate: 200 }}</p>
8
-
9
8
  </li>
10
9
  {% endfor %}
11
10
  </ul>
@@ -0,0 +1,6 @@
1
+ node count(init: int; reset, event: bool) returns (c: int);
2
+ let
3
+ c = init -> if reset then init
4
+ else if event then pre(c)+1
5
+ else pre(c);
6
+ tel;
@@ -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
@@ -0,0 +1,6 @@
1
+ SELECT ?item ?itemLabel
2
+ WHERE
3
+ {
4
+ ?item wdt:P31 wd:Q146.
5
+ SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
6
+ }
@@ -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
- }
@@ -126,6 +126,11 @@ module Rouge
126
126
 
127
127
  next PlainText
128
128
  end
129
+
130
+ disambiguate '*.cls' do
131
+ next TeX if matches?(/\A\s*(?:\\|%)/)
132
+ next Apex
133
+ end
129
134
  end
130
135
  end
131
136
  end
@@ -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