rouge 3.10.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fb254c48c7225eb55006a7e1fb0cd713afa34faf35d4f4c92bec44c663a7a49
4
- data.tar.gz: 0d5193efc0336f18a8012f09135deb4eb988051367b78928c5b7bc61f3f0b49c
3
+ metadata.gz: af9642af1b39983bc72b54801f0986c921189c8f7cc8278d12eeae97c7902834
4
+ data.tar.gz: 57d9ff3da43e6af6786dea87123eaf1ae4c4b0eb02deaf080545bf9d9688c402
5
5
  SHA512:
6
- metadata.gz: 41128ed9650fe8aa804d9c93c44ebaf8f93131ee156ed1b57acfd1b790f435cf9f7f2233fd7ca3701b206b7131d979a2517abbf87da6c01ca931ec8d7ac4c04b
7
- data.tar.gz: 255518b66c766562b22005ade1eebc7bf092e3b29b1f5fe298b0497801a86de2e350e726b57ac52380d58e9aa28bfb84cff2f917759053548704bd2bb4bf4b8c
6
+ metadata.gz: fa061de07871482934ed94381116ea44bdaafce68dea9a19a7c9852c89f32905d825a19abaa37d5aa6a43299c3b077b1658cc3e9dd6aa1ba0f814edf5d788e28
7
+ data.tar.gz: 55c77122c00af3eb4076e140a55a1d42a1ba1d3f2bc8c6c831f76feaf6e66636dc88f2ef17e07851711db91fb76868b5129c337f57ac94c913837e1d38f6fb1b
@@ -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,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
@@ -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,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
@@ -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
@@ -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
@@ -58,7 +58,7 @@ module Rouge
58
58
 
59
59
  def self.keyopts
60
60
  @keyopts ||= Set.new %w(
61
- := => -> /\\ \\/ _ ; :> :
61
+ := => -> /\\ \\/ _ ; :> : ⇒ → ↔ ⇔ ≔ ≡ ∀ ∃ ∧ ∨ ¬ ⊤ ⊥ ⊢ ⊨ ∈
62
62
  )
63
63
  end
64
64
 
@@ -115,14 +115,6 @@ module Rouge
115
115
  end
116
116
  rule %r(/\\), Operator
117
117
  rule %r/\\\//, Operator
118
- rule operator do |m|
119
- match = m[0]
120
- if self.class.keyopts.include? match
121
- token Punctuation
122
- else
123
- token Operator
124
- end
125
- end
126
118
 
127
119
  rule %r/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float
128
120
  rule %r/\d[\d_]*/, Num::Integer
@@ -131,6 +123,17 @@ module Rouge
131
123
  rule %r/'/, Keyword
132
124
  rule %r/"/, Str::Double, :string
133
125
  rule %r/[~?]#{id}/, Name::Variable
126
+
127
+ rule %r/./ do |m|
128
+ match = m[0]
129
+ if self.class.keyopts.include? match
130
+ token Punctuation
131
+ elsif match =~ operator
132
+ token Operator
133
+ else
134
+ token Error
135
+ end
136
+ end
134
137
  end
135
138
 
136
139
  state :comment do
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class CSVS < RegexLexer
7
+ tag 'csvs'
8
+ title "csvs"
9
+ desc 'The CSV Schema Language (digital-preservation.github.io)'
10
+ filenames '*.csvs'
11
+
12
+ state :root do
13
+ rule %r/\s+/m, Text
14
+
15
+ rule %r(//[\S\t ]*), Comment::Single
16
+ rule %r(/\*[^*]*\*/)m, Comment::Multiline
17
+
18
+ rule %r/(version)( )(\d+\.\d+)/ do
19
+ groups Keyword, Text::Whitespace, Num::Float
20
+ end
21
+
22
+ rule %r/T?\d{2}:\d{2}:\d{2}(\.\d{5})?(Z|(?:[-+]\d{2}:\d{2}))?/, Literal::Date
23
+ rule %r/\d{4}-\d{2}-\d{2}/, Literal::Date
24
+ rule %r/\d{2}\/\d{2}\/\d{4}/, Literal::Date
25
+
26
+ rule %r((\d+[.]?\d*|\d*[.]\d+)(e[+-]?[0-9]+)?)i, Num::Float
27
+ rule %r/\d+/, Num::Integer
28
+
29
+ rule %r/@\w+/, Keyword::Pseudo
30
+
31
+ rule %r/[-.\w]+:/, Name::Variable
32
+ rule %r/^"[^"]+"/, Name::Variable
33
+ rule %r/\$([-.\w]+|("[^"]+"))\/?/, Name::Variable
34
+
35
+ rule %r/[A-Z]+/i, Keyword
36
+
37
+ rule %r/"[^"]*"/, Str::Double
38
+ rule %r/'[^\r\n\f']'/, Str::Char
39
+
40
+ rule %r/[,()*]/, Punctuation
41
+ end
42
+ end
43
+ end
44
+ end
@@ -34,7 +34,7 @@ module Rouge
34
34
  end
35
35
 
36
36
  state :name do
37
- rule %r/("(?:\\.|[^"\n])*?")(\s*)(:)/ do
37
+ rule %r/("(?:\\.|[^"\\\n])*?")(\s*)(:)/ do
38
38
  groups Name::Label, Text::Whitespace, Punctuation
39
39
  end
40
40
  end
@@ -24,19 +24,12 @@ module Rouge
24
24
  while yield
25
25
  )
26
26
 
27
- name = %r'@?[_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}][\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}\p{Nd}\p{Pc}\p{Cf}\p{Mn}\p{Mc}]*'
28
- name_backtick = %r'#{name}|`#{name}`'
27
+ name_chars = %r'[-_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}\p{Nd}\p{Pc}\p{Cf}\p{Mn}\p{Mc}]*'
29
28
 
30
- id = %r'(#{name_backtick})'
29
+ class_name = %r'`?[\p{Lu}]#{name_chars}`?'
30
+ name = %r'`?[_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}]#{name_chars}`?'
31
31
 
32
32
  state :root do
33
- rule %r'(\))(\s*)(:)(\s+)(#{name_backtick})(<)' do
34
- groups Punctuation, Text, Punctuation, Text, Name::Class, Punctuation
35
- push :generic_parameters
36
- end
37
- rule %r'(\))(\s*)(:)(\s+)(#{name_backtick})' do
38
- groups Punctuation, Text, Punctuation, Text, Name::Class
39
- end
40
33
  rule %r'\b(companion)(\s+)(object)\b' do
41
34
  groups Keyword, Text, Keyword
42
35
  end
@@ -48,13 +41,6 @@ module Rouge
48
41
  groups Keyword, Text
49
42
  push :function
50
43
  end
51
- rule %r'(#{name_backtick})(:)(\s+)(#{name_backtick})(<)' do
52
- groups Name::Variable, Punctuation, Text, Name::Class, Punctuation
53
- push :generic_parameters
54
- end
55
- rule %r'(#{name_backtick})(:)(\s+)(#{name_backtick})' do
56
- groups Name::Variable, Punctuation, Text, Name::Class
57
- end
58
44
  rule %r'\b(package|import)(\s+)' do
59
45
  groups Keyword, Text
60
46
  push :package
@@ -67,8 +53,8 @@ module Rouge
67
53
  groups Keyword::Declaration, Text
68
54
  push :property
69
55
  end
70
- rule %r/\bfun\b/, Keyword
71
- rule %r/\b(?:#{keywords.join('|')})\b/, Keyword
56
+ rule %r'\bfun\b', Keyword
57
+ rule %r'\b(?:#{keywords.join('|')})\b', Keyword
72
58
  rule %r'^\s*\[.*?\]', Name::Attribute
73
59
  rule %r'[^\S\n]+', Text
74
60
  rule %r'\\\n', Text # line continuation
@@ -85,43 +71,50 @@ module Rouge
85
71
  rule %r'"(\\\\|\\"|[^"\n])*["\n]'m, Str
86
72
  rule %r"'\\.'|'[^\\]'", Str::Char
87
73
  rule %r"[0-9](\.[0-9]+)?([eE][+-][0-9]+)?[flFL]?|0[xX][0-9a-fA-F]+[Ll]?", Num
88
- rule %r/@#{id}/, Name::Decorator
89
- rule id, Name
74
+ rule %r'(@#{class_name})', Name::Decorator
75
+ rule %r'(#{class_name})(<)' do
76
+ groups Name::Class, Punctuation
77
+ push :generic_parameters
78
+ end
79
+ rule class_name, Name::Class
80
+ rule %r'(#{name})(?=\s*[({])', Name::Function
81
+ rule name, Name
90
82
  end
91
83
 
92
84
  state :package do
93
- rule %r/\S+/, Name::Namespace, :pop!
85
+ rule %r'\S+', Name::Namespace, :pop!
94
86
  end
95
87
 
96
88
  state :class do
97
- rule id, Name::Class, :pop!
89
+ rule class_name, Name::Class, :pop!
98
90
  end
99
91
 
100
92
  state :function do
101
93
  rule %r'(<)', Punctuation, :generic_parameters
102
94
  rule %r'(\s+)', Text
103
- rule %r'(#{name_backtick})(\.)' do
95
+ rule %r'(#{class_name})(\.)' do
104
96
  groups Name::Class, Punctuation
105
97
  end
106
- rule id, Name::Function, :pop!
98
+ rule name, Name::Function, :pop!
107
99
  end
108
100
 
109
101
  state :generic_parameters do
110
- rule id, Name::Class
102
+ rule class_name, Name::Class
103
+ rule %r'(<)', Punctuation, :generic_parameters
111
104
  rule %r'(,)', Punctuation
112
105
  rule %r'(\s+)', Text
113
106
  rule %r'(>)', Punctuation, :pop!
114
107
  end
115
108
 
116
109
  state :property do
117
- rule id, Name::Property, :pop!
110
+ rule name, Name::Property, :pop!
118
111
  end
119
112
 
120
113
  state :destructure do
121
114
  rule %r'(,)', Punctuation
122
115
  rule %r'(\))', Punctuation, :pop!
123
116
  rule %r'(\s+)', Text
124
- rule id, Name::Property
117
+ rule name, Name::Property
125
118
  end
126
119
 
127
120
  state :comment do
@@ -12,12 +12,12 @@ module Rouge
12
12
  state :root do
13
13
  rule %r/[^\{]+/, Text
14
14
 
15
- rule %r/(\{%)(\s*)/ do
15
+ rule %r/(\{%-?)(\s*)/ do
16
16
  groups Punctuation, Text::Whitespace
17
17
  push :tag_or_block
18
18
  end
19
19
 
20
- rule %r/(\{\{)(\s*)/ do
20
+ rule %r/(\{\{-?)(\s*)/ do
21
21
  groups Punctuation, Text::Whitespace
22
22
  push :output
23
23
  end
@@ -27,78 +27,70 @@ module Rouge
27
27
 
28
28
  state :tag_or_block do
29
29
  # builtin logic blocks
30
- rule %r/(if|unless|elsif|case)(?=\s+)/, Keyword::Reserved, :condition
30
+ rule %r/(if|elsif|unless|case)\b/, Keyword::Reserved, :condition
31
+ rule %r/(when)\b/, Keyword::Reserved, :when
31
32
 
32
- rule %r/(when)(\s+)/ do
33
- groups Keyword::Reserved, Text::Whitespace
34
- push :when
35
- end
36
-
37
- rule %r/(else)(\s*)(%\})/ do
33
+ rule %r/(else)(\s*)(-?%\})/ do
38
34
  groups Keyword::Reserved, Text::Whitespace, Punctuation
39
35
  pop!
40
36
  end
41
37
 
42
38
  # other builtin blocks
43
- rule %r/(capture)(\s+)([^\s%]+)(\s*)(%\})/ do
44
- groups Name::Tag, Text::Whitespace, Name::Attribute, Text::Whitespace, Punctuation
39
+ rule %r/(capture|(?:in|de)crement)(\s+)([^\s%]+)(\s*)(-?%\})/ do
40
+ groups Name::Tag, Text::Whitespace, Name::Variable, Text::Whitespace, Punctuation
45
41
  pop!
46
42
  end
47
43
 
48
- rule %r/(comment)(\s*)(%\})/ do
44
+ rule %r/(comment)(\s*)(-?%\})/ do
49
45
  groups Name::Tag, Text::Whitespace, Punctuation
50
46
  push :comment
51
47
  end
52
48
 
53
- rule %r/(raw)(\s*)(%\})/ do
49
+ rule %r/(raw)(\s*)(-?%\})/ do
54
50
  groups Name::Tag, Text::Whitespace, Punctuation
55
51
  push :raw
56
52
  end
57
53
 
58
- rule %r/assign/, Name::Tag, :assign
59
- rule %r/include/, Name::Tag, :include
60
-
61
54
  # end of block
62
- rule %r/(end(?:case|unless|if))(\s*)(%\})/ do
55
+ rule %r/(end(?:if|unless|case))(\s*)(-?%\})/ do
63
56
  groups Keyword::Reserved, Text::Whitespace, Punctuation
64
57
  pop!
65
58
  end
66
59
 
67
- rule %r/(end(?:[^\s%]+))(\s*)(%\})/ do
60
+ rule %r/(end(?:[^\s%]+))(\s*)(-?%\})/ do
68
61
  groups Name::Tag, Text::Whitespace, Punctuation
69
62
  pop!
70
63
  end
71
64
 
72
65
  # builtin tags
73
- rule %r/(cycle)(\s+)(([^\s:]*)(:))?(\s*)/ do |m|
74
- token Name::Tag, m[1]
75
- token Text::Whitespace, m[2]
66
+ rule %r/(assign|echo)\b/, Name::Tag, :assign
67
+ rule %r/(include|render)\b/, Name::Tag, :include
76
68
 
77
- if m[4] =~ /'[^']*'/
78
- token Str::Single, m[4]
79
- elsif m[4] =~ /"[^"]*"/
80
- token Str::Double, m[4]
81
- else
82
- token Name::Attribute, m[4]
83
- end
69
+ rule %r/(cycle)(\s+)(?:([^\s:]*)(\s*)(:))?(\s*)/ do |m|
70
+ token_class = case m[3]
71
+ when %r/'[^']*'/ then Str::Single
72
+ when %r/"[^"]*"/ then Str::Double
73
+ else
74
+ Name::Attribute
75
+ end
84
76
 
85
- token Punctuation, m[5]
86
- token Text::Whitespace, m[6]
77
+ groups Name::Tag, Text::Whitespace, token_class,
78
+ Text::Whitespace, Punctuation, Text::Whitespace
87
79
 
88
80
  push :variable_tag_markup
89
81
  end
90
82
 
91
83
  # iteration
92
84
  rule %r/
93
- (for)(\s+)
85
+ (for|tablerow)(\s+)
94
86
  ([\w-]+)(\s+)
95
87
  (in)(\s+)
96
88
  (
97
- (?: [^\s,\|'"] | (?:"[^"]*"|'[^']*') )+
89
+ (?: [^\s%,\|'"] | (?:"[^"]*"|'[^']*') )+
98
90
  )(\s*)
99
91
  /x do |m|
100
92
  groups Name::Tag, Text::Whitespace, Name::Variable, Text::Whitespace,
101
- Keyword::Reserved, Text::Whitespace
93
+ Name::Tag, Text::Whitespace
102
94
 
103
95
  token_class = case m[7]
104
96
  when %r/'[^']*'/ then Str::Single
@@ -119,105 +111,76 @@ module Rouge
119
111
  end
120
112
 
121
113
  state :output do
122
- mixin :whitespace
123
- mixin :generic
114
+ rule %r/(\|)(\s*)([a-zA-Z_][^\s}\|:]*)/ do
115
+ groups Punctuation, Text::Whitespace, Name::Function
116
+ push :filters
117
+ end
124
118
 
125
- rule %r/\}\}/, Punctuation, :pop!
126
- rule %r/\|/, Punctuation, :filters
119
+ mixin :end_of_tag
120
+ mixin :generic
127
121
  end
128
122
 
129
123
  state :filters do
130
- mixin :whitespace
131
-
132
- rule(/\}\}/) { token Punctuation; reset_stack }
133
-
134
- rule %r/([^\s\|:]+)(:?)(\s*)/ do
135
- groups Name::Function, Punctuation, Text::Whitespace
136
- push :filter_markup
124
+ rule %r/(\|)(\s*)([a-zA-Z_][^\s%}\|:]*)/ do
125
+ groups Punctuation, Text::Whitespace, Name::Function
137
126
  end
138
- end
139
-
140
- state :filter_markup do
141
- rule %r/\|/, Punctuation, :pop!
142
127
 
143
128
  mixin :end_of_tag
144
129
  mixin :end_of_block
145
- mixin :default_param_markup
130
+ mixin :variable_param_markup
146
131
  end
147
132
 
148
133
  state :condition do
149
- mixin :end_of_block
150
- mixin :whitespace
151
-
152
- rule %r/([=!><]=?)/, Operator
153
-
154
- rule %r/\b(?:(!)|(not\b))/ do
155
- groups Operator, Operator::Word
156
- end
157
-
158
- rule %r/(contains)/, Operator::Word
134
+ rule %r/([=!]=|[<>]=?)/, Operator
135
+ rule %r/(and|or|contains)\b/, Operator::Word
159
136
 
137
+ mixin :end_of_block
160
138
  mixin :generic
161
- mixin :whitespace
162
139
  end
163
140
 
164
141
  state :when do
165
142
  mixin :end_of_block
166
- mixin :whitespace
167
143
  mixin :generic
168
144
  end
169
145
 
170
- state :operator do
171
- rule %r/(\s*)((?:=|!|>|<)=?)(\s*)/ do
172
- groups Text::Whitespace, Operator, Text::Whitespace
173
- pop!
174
- end
175
-
176
- rule %r/(\s*)(\bcontains\b)(\s*)/ do
177
- groups Text::Whitespace, Operator::Word, Text::Whitespace
178
- pop!
179
- end
180
- end
181
-
182
146
  state :end_of_tag do
183
- rule(/\}\}/) { token Punctuation; reset_stack }
147
+ rule(/-?\}\}/) { token Punctuation; reset_stack }
184
148
  end
185
149
 
186
150
  state :end_of_block do
187
- rule(/%\}/) { token Punctuation; reset_stack }
151
+ rule(/-?%\}/) { token Punctuation; reset_stack }
188
152
  end
189
153
 
190
154
  # states for unknown markup
191
155
  state :param_markup do
192
156
  mixin :whitespace
157
+ mixin :keyword
193
158
  mixin :string
159
+ mixin :number
194
160
 
195
161
  rule %r/([^\s=:]+)(\s*)(=|:)/ do
196
162
  groups Name::Attribute, Text::Whitespace, Operator
197
163
  end
198
164
 
199
- rule %r/(\{\{)(\s*)([^\s\}])(\s*)(\}\})/ do
200
- groups Punctuation, Text::Whitespace, Text, Text::Whitespace, Punctuation
201
- end
202
-
203
- mixin :number
204
- mixin :keyword
205
-
206
- rule %r/,/, Punctuation
165
+ rule %r/[,:]/, Punctuation
207
166
  end
208
167
 
209
168
  state :default_param_markup do
210
169
  mixin :param_markup
211
- rule %r/./, Text
170
+
171
+ rule %r/\S+/, Text
212
172
  end
213
173
 
214
174
  state :variable_param_markup do
215
175
  mixin :param_markup
216
176
  mixin :variable
217
- rule %r/./, Text
177
+
178
+ rule %r/\S+/, Text
218
179
  end
219
180
 
220
181
  state :tag_markup do
182
+ rule %r/(reversed)\b/, Name::Attribute
183
+
221
184
  mixin :end_of_block
222
185
  mixin :default_param_markup
223
186
  end
@@ -229,12 +192,14 @@ module Rouge
229
192
 
230
193
  # states for different values types
231
194
  state :keyword do
232
- rule %r/\b(false|true)\b/, Keyword::Constant
195
+ rule %r/(false|true|nil)\b/, Keyword::Constant
233
196
  end
234
197
 
235
198
  state :variable do
236
- rule %r/\.(?=\w)/, Punctuation
237
- rule %r/[a-zA-Z_]\w*\??/, Name::Variable
199
+ rule %r/(empty|blank|forloop\.[^\s%}\|:]+)\b/, Name::Builtin
200
+ rule %r/\.(?=\w)|\[|\]/, Punctuation
201
+ rule %r/(first|last|size)\b/, Name::Function
202
+ rule %r/[a-zA-Z_][\w-]*\??/, Name::Variable
238
203
  end
239
204
 
240
205
  state :string do
@@ -243,21 +208,17 @@ module Rouge
243
208
  end
244
209
 
245
210
  state :number do
211
+ rule %r/-/, Operator
246
212
  rule %r/\d+\.\d+/, Num::Float
247
213
  rule %r/\d+/, Num::Integer
248
214
  end
249
215
 
250
- state :array_index do
251
- rule %r/\[/, Punctuation
252
- rule %r/\]/, Punctuation
253
- end
254
-
255
216
  state :generic do
256
- mixin :array_index
217
+ mixin :whitespace
257
218
  mixin :keyword
258
219
  mixin :string
259
- mixin :variable
260
220
  mixin :number
221
+ mixin :variable
261
222
  end
262
223
 
263
224
  state :whitespace do
@@ -265,18 +226,20 @@ module Rouge
265
226
  end
266
227
 
267
228
  state :comment do
268
- rule %r/(\{%)(\s*)(endcomment)(\s*)(%\})/ do
229
+ rule %r/[^\{]+/, Comment
230
+
231
+ rule %r/(\{%-?)(\s*)(endcomment)(\s*)(-?%\})/ do
269
232
  groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
270
233
  reset_stack
271
234
  end
272
235
 
273
- rule %r/./, Comment
236
+ rule %r/\{/, Comment
274
237
  end
275
238
 
276
239
  state :raw do
277
240
  rule %r/[^\{]+/, Text
278
241
 
279
- rule %r/(\{%)(\s*)(endraw)(\s*)(%\})/ do
242
+ rule %r/(\{%-?)(\s*)(endraw)(\s*)(-?%\})/ do
280
243
  groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
281
244
  reset_stack
282
245
  end
@@ -285,27 +248,38 @@ module Rouge
285
248
  end
286
249
 
287
250
  state :assign do
288
- mixin :whitespace
289
- mixin :end_of_block
251
+ rule %r/=/, Operator
290
252
 
291
- rule %r/(\s*)(=)(\s*)/ do
292
- groups Text::Whitespace, Operator, Text::Whitespace
253
+ rule %r/(\|)(\s*)([a-zA-Z_][^\s%\|:]*)/ do
254
+ groups Punctuation, Text::Whitespace, Name::Function
255
+ push :filters
293
256
  end
294
257
 
295
- rule %r/\|/, Punctuation, :filters
296
-
258
+ mixin :end_of_block
297
259
  mixin :generic
298
260
  end
299
261
 
300
262
  state :include do
301
- mixin :whitespace
302
-
303
- rule %r/([^\.]+)(\.)(html|liquid)/ do
304
- groups Name::Attribute, Punctuation, Name::Attribute
263
+ rule %r/(\{\{-?)(\s*)/ do
264
+ groups Punctuation, Text::Whitespace
265
+ push :output_embed
305
266
  end
306
267
 
268
+ rule %r/(with|for)\b/, Name::Tag
269
+ rule %r/[^\s\.]+(\.[^\s\.]+)+\b/, Name::Other
270
+
307
271
  mixin :variable_tag_markup
308
272
  end
273
+
274
+ state :output_embed do
275
+ rule %r/(\|)(\s*)([a-zA-Z_][^\s}\|:]*)/ do
276
+ groups Punctuation, Text::Whitespace, Name::Function
277
+ end
278
+
279
+ rule %r/-?\}\}/, Punctuation, :pop!
280
+
281
+ mixin :variable_param_markup
282
+ end
309
283
  end
310
284
  end
311
285
  end
@@ -0,0 +1,249 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class RobotFramework < RegexLexer
7
+ tag 'robot_framework'
8
+ aliases 'robot', 'robot-framework'
9
+
10
+ title "Robot Framework"
11
+ desc 'Robot Framework is a generic open source automation testing framework (robotframework.org)'
12
+
13
+ filenames '*.robot'
14
+ mimetypes 'text/x-robot'
15
+
16
+ def initialize(opts = {})
17
+ super(opts)
18
+ @col = 0
19
+ @next = nil
20
+ @is_template = false
21
+ end
22
+
23
+ def self.settings_with_keywords
24
+ @settings_with_keywords ||= Set.new [
25
+ "library", "resource", "setup", "teardown", "template", "suite setup",
26
+ "suite teardown", "task setup", "task teardown", "task template",
27
+ "test setup", "test teardown", "test template", "variables"
28
+ ]
29
+ end
30
+
31
+ def self.settings_with_args
32
+ @settings_with_args ||= Set.new [
33
+ "arguments", "default tags", "documentation", "force tags",
34
+ "metadata", "return", "tags", "timeout", "task timeout",
35
+ "test timeout"
36
+ ]
37
+ end
38
+
39
+ id = %r/(?:\\|[^|$@&% \t\n])+(?: (?:\\.|[^|$@&% \t\n])+)*/
40
+ bdd = %r/(?:Given|When|Then|And|But) /i
41
+ sep = %r/ +\| +|[ ]{2,}|\t+/
42
+
43
+ start do
44
+ push :prior_text
45
+ end
46
+
47
+ state :prior_text do
48
+ rule %r/^[^*].*/, Text
49
+ rule(//) { pop! }
50
+ end
51
+
52
+ # Mixins
53
+
54
+ state :whitespace do
55
+ rule %r/\s+/, Text::Whitespace
56
+ end
57
+
58
+ state :section_include do
59
+ mixin :end_section
60
+ mixin :sep
61
+ mixin :newline
62
+ end
63
+
64
+ state :end_section do
65
+ rule(/(?=^(?:\| )?\*)/) { pop! }
66
+ end
67
+
68
+ state :return do
69
+ rule(//) { pop! }
70
+ end
71
+
72
+ state :sep do
73
+ rule %r/\| /, Text::Whitespace
74
+
75
+ rule sep do
76
+ token Text::Whitespace
77
+ @col = @col + 1
78
+ if @next
79
+ push @next
80
+ elsif @is_template
81
+ push :args
82
+ elsif @col == 1
83
+ @next = :keyword
84
+ push :keyword
85
+ else
86
+ push :args
87
+ end
88
+ push :cell_start
89
+ end
90
+
91
+ rule %r/\.\.\. */ do
92
+ token Text::Whitespace
93
+ @col = @col + 1
94
+ push :args
95
+ end
96
+
97
+ rule %r/ ?\|/, Text::Whitespace
98
+ end
99
+
100
+ state :newline do
101
+ rule %r/\n/ do
102
+ token Text::Whitespace
103
+ @col = 0
104
+ @next = nil
105
+ push :cell_start
106
+ end
107
+ end
108
+
109
+ # States
110
+
111
+ state :root do
112
+ mixin :whitespace
113
+
114
+ rule %r/^(?:\| )?\*[* ]*([A-Z]+(?: [A-Z]+)?).*/i do |m|
115
+ token Generic::Heading, m[0]
116
+ case m[1].chomp("s").downcase
117
+ when "setting" then push :section_settings
118
+ when "test case" then push :section_tests
119
+ when "task" then push :section_tasks
120
+ when "keyword" then push :section_keywords
121
+ when "variable" then push :section_variables
122
+ end
123
+ end
124
+ end
125
+
126
+ state :section_settings do
127
+ mixin :section_include
128
+
129
+ rule %r/([A-Z]+(?: [A-Z]+)?)(:?)/i do |m|
130
+ match = m[1].downcase
131
+ @next = if self.class.settings_with_keywords.include? match
132
+ :keyword
133
+ elsif self.class.settings_with_args.include? match
134
+ :args
135
+ end
136
+ groups Name::Builtin::Pseudo, Punctuation
137
+ end
138
+ end
139
+
140
+ state :section_tests do
141
+ mixin :section_include
142
+
143
+ rule %r/[$@&%{}]+/, Name::Label
144
+ rule %r/( )(?![ |])/, Name::Label
145
+
146
+ rule id do
147
+ @is_template = false
148
+ token Name::Label
149
+ end
150
+ end
151
+
152
+ state :section_tasks do
153
+ mixin :section_tests
154
+ end
155
+
156
+ state :section_keywords do
157
+ mixin :section_include
158
+
159
+ rule %r/[$@&%]\{/ do
160
+ token Name::Variable
161
+ push :var
162
+ end
163
+
164
+ rule %r/[$@&%{}]+/, Name::Label
165
+ rule %r/( )(?![ |])/, Name::Label
166
+
167
+ rule id, Name::Label
168
+ end
169
+
170
+ state :section_variables do
171
+ mixin :section_include
172
+
173
+ rule %r/[$@&%]\{/ do
174
+ token Name::Variable
175
+ @next = :args
176
+ push :var
177
+ end
178
+ end
179
+
180
+ state :cell_start do
181
+ rule %r/#.*/, Comment
182
+ mixin :return
183
+ end
184
+
185
+ state :keyword do
186
+ rule %r/(\[)([A-Z]+(?: [A-Z]+)?)(\])/i do |m|
187
+ groups Punctuation, Name::Builtin::Pseudo, Punctuation
188
+
189
+ match = m[2].downcase
190
+ @is_template = true if match == "template"
191
+ if self.class.settings_with_keywords.include? match
192
+ @next = :keyword
193
+ elsif self.class.settings_with_args.include? match
194
+ @next = :args
195
+ end
196
+
197
+ pop!
198
+ end
199
+
200
+ rule %r/[$@&%]\{/ do
201
+ token Name::Variable
202
+ @next = :keyword unless @next.nil?
203
+ push :var
204
+ end
205
+
206
+ rule %r/FOR/i do
207
+ token Name::Function
208
+ @next = :keyword unless @next.nil?
209
+ end
210
+
211
+ rule %r/( )(?![ |])/, Name::Function
212
+
213
+ rule bdd, Name::Builtin
214
+ rule id do
215
+ token Name::Function
216
+ @next = nil
217
+ end
218
+
219
+ mixin :return
220
+ end
221
+
222
+ state :args do
223
+ rule %r/[$@&%]\{/ do
224
+ token Name::Variable
225
+ @next = :keyword unless @next.nil?
226
+ push :var
227
+ end
228
+
229
+ rule %r/[$@&%]+/, Str
230
+ rule %r/( )(?![ |])/, Str
231
+ rule id, Str
232
+
233
+ mixin :return
234
+ end
235
+
236
+ state :var do
237
+ rule %r/(\})( )(=)/ do
238
+ groups Name::Variable, Text::Whitespace, Punctuation
239
+ pop!
240
+ end
241
+ rule %r/[$@&%]\{/, Name::Variable, :var
242
+ rule %r/[{\[]/, Name::Variable, :var
243
+ rule %r/[}\]]/, Name::Variable, :pop!
244
+ rule %r/[^$@&%{}\[\]]+/, Name::Variable
245
+ rule %r/\}\[/, Name::Variable
246
+ end
247
+ end
248
+ end
249
+ end
@@ -9,10 +9,12 @@ module Rouge
9
9
 
10
10
  tag 'shell'
11
11
  aliases 'bash', 'zsh', 'ksh', 'sh'
12
- filenames '*.sh', '*.bash', '*.zsh', '*.ksh',
13
- '.bashrc', '.zshrc', '.kshrc', '.profile', 'APKBUILD', 'PKGBUILD'
12
+ filenames '*.sh', '*.bash', '*.zsh', '*.ksh', '.bashrc', '.zshrc',
13
+ '.kshrc', '.profile', 'APKBUILD', 'PKGBUILD', '*.ebuild',
14
+ '*.eclass', '*.exheres-0', '*.exlib'
14
15
 
15
- mimetypes 'application/x-sh', 'application/x-shellscript'
16
+ mimetypes 'application/x-sh', 'application/x-shellscript', 'text/x-sh',
17
+ 'text/x-shellscript'
16
18
 
17
19
  def self.detect?(text)
18
20
  return true if text.shebang?(/(ba|z|k)?sh/)
@@ -80,7 +80,7 @@ module Rouge
80
80
  rule %r/0b[01]+(?:_[01]+)*/, Num::Bin
81
81
  rule %r{[\d]+(?:_\d+)*}, Num::Integer
82
82
 
83
- rule %r/@#{id}(\([^)]+\))?/, Keyword::Declaration
83
+ rule %r/@#{id}/, Keyword::Declaration
84
84
 
85
85
  rule %r/(private|internal)(\([ ]*)(\w+)([ ]*\))/ do |m|
86
86
  if m[3] == 'set'
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.10.0"
6
+ "3.11.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
14
14
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - lib/rouge/demos/actionscript
28
28
  - lib/rouge/demos/ada
29
29
  - lib/rouge/demos/apache
30
+ - lib/rouge/demos/apex
30
31
  - lib/rouge/demos/apiblueprint
31
32
  - lib/rouge/demos/applescript
32
33
  - lib/rouge/demos/armasm
@@ -53,6 +54,7 @@ files:
53
54
  - lib/rouge/demos/crystal
54
55
  - lib/rouge/demos/csharp
55
56
  - lib/rouge/demos/css
57
+ - lib/rouge/demos/csvs
56
58
  - lib/rouge/demos/cuda
57
59
  - lib/rouge/demos/cython
58
60
  - lib/rouge/demos/d
@@ -153,6 +155,7 @@ files:
153
155
  - lib/rouge/demos/r
154
156
  - lib/rouge/demos/racket
155
157
  - lib/rouge/demos/reasonml
158
+ - lib/rouge/demos/robot_framework
156
159
  - lib/rouge/demos/ruby
157
160
  - lib/rouge/demos/rust
158
161
  - lib/rouge/demos/sas
@@ -219,6 +222,7 @@ files:
219
222
  - lib/rouge/lexers/ada.rb
220
223
  - lib/rouge/lexers/apache.rb
221
224
  - lib/rouge/lexers/apache/keywords.yml
225
+ - lib/rouge/lexers/apex.rb
222
226
  - lib/rouge/lexers/apiblueprint.rb
223
227
  - lib/rouge/lexers/apple_script.rb
224
228
  - lib/rouge/lexers/armasm.rb
@@ -245,6 +249,7 @@ files:
245
249
  - lib/rouge/lexers/crystal.rb
246
250
  - lib/rouge/lexers/csharp.rb
247
251
  - lib/rouge/lexers/css.rb
252
+ - lib/rouge/lexers/csvs.rb
248
253
  - lib/rouge/lexers/cuda.rb
249
254
  - lib/rouge/lexers/cython.rb
250
255
  - lib/rouge/lexers/d.rb
@@ -351,6 +356,7 @@ files:
351
356
  - lib/rouge/lexers/r.rb
352
357
  - lib/rouge/lexers/racket.rb
353
358
  - lib/rouge/lexers/reasonml.rb
359
+ - lib/rouge/lexers/robot_framework.rb
354
360
  - lib/rouge/lexers/ruby.rb
355
361
  - lib/rouge/lexers/rust.rb
356
362
  - lib/rouge/lexers/sas.rb