rouge 4.1.0 → 4.2.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/demos/codeowners +6 -0
- data/lib/rouge/demos/svelte +29 -0
- data/lib/rouge/guessers/disambiguation.rb +7 -0
- data/lib/rouge/lexers/bpf.rb +10 -10
- data/lib/rouge/lexers/codeowners.rb +30 -0
- data/lib/rouge/lexers/dart.rb +6 -6
- data/lib/rouge/lexers/dot.rb +1 -0
- data/lib/rouge/lexers/elixir.rb +4 -0
- data/lib/rouge/lexers/groovy.rb +3 -3
- data/lib/rouge/lexers/hcl.rb +3 -2
- data/lib/rouge/lexers/irb.rb +7 -1
- data/lib/rouge/lexers/javascript.rb +8 -1
- data/lib/rouge/lexers/jinja.rb +10 -10
- data/lib/rouge/lexers/liquid.rb +164 -164
- data/lib/rouge/lexers/mosel.rb +0 -4
- data/lib/rouge/lexers/openedge.rb +581 -376
- data/lib/rouge/lexers/php.rb +2 -2
- data/lib/rouge/lexers/python.rb +19 -5
- data/lib/rouge/lexers/ruby.rb +2 -1
- data/lib/rouge/lexers/rust.rb +7 -6
- data/lib/rouge/lexers/shell.rb +6 -2
- data/lib/rouge/lexers/svelte.rb +91 -0
- data/lib/rouge/lexers/swift.rb +32 -16
- data/lib/rouge/lexers/terraform.rb +0 -8
- data/lib/rouge/lexers/twig.rb +9 -9
- data/lib/rouge/lexers/typescript.rb +2 -2
- data/lib/rouge/lexers/wollok.rb +6 -2
- data/lib/rouge/lexers/xojo.rb +5 -5
- data/lib/rouge/lexers/xquery.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3281f8cbea5fa288016ada176d8fd748d2426af2f6a02a49c4f519ae4a385c9
|
|
4
|
+
data.tar.gz: a0e5aae51677fa27c6c448d3d617b0f4748934ad267dc0be49b705e2fc89f93b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fe33d5d2a60be45a82839227de784d92440a99c77e700d55cba412f1d8a2cb5b516013bd92f7db62f88a25fa6aee8bdd65415cd9c2203c1e4a1538549d7a1a7
|
|
7
|
+
data.tar.gz: 1b4598ed31db53da50a79e5aeaff8eca539c91dd7102b07a7e1106c4bd050071e689fb21a4d435b2e8d465cb91ae8a9275a91d777509961a6c95739e1ecc8d76
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- This file is made up from several examples on https://svelte.dev/examples and is not expected to function. -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import Image from './Image.svelte';
|
|
4
|
+
|
|
5
|
+
let src: string = '/tutorial/image.gif';
|
|
6
|
+
let count: number = 1;
|
|
7
|
+
$: doubled = count * 2; // the `$:` is special in svelte
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Image {src} bind:alt="{name.capitalize()} dancing" user={name.toUpperCase(false, 42, {key: 'value'})}
|
|
11
|
+
tooltip="I'm helping" false text=asdf on:message={handleMessage} />
|
|
12
|
+
|
|
13
|
+
{#await loadSrc(src)}
|
|
14
|
+
loading...
|
|
15
|
+
{:then data}
|
|
16
|
+
{#each cats as { name }, i}
|
|
17
|
+
<li>{name}</li>
|
|
18
|
+
{/each}
|
|
19
|
+
|
|
20
|
+
<!-- Keyed Each Block -->
|
|
21
|
+
{#each cats as cat (cat.id)}
|
|
22
|
+
<li>{cat.name}</li>
|
|
23
|
+
{/each}
|
|
24
|
+
{:catch err}
|
|
25
|
+
{@debug err}
|
|
26
|
+
{#await solveErr(err, {x: 'asdf'}) then reason}{@html reason}{/await}
|
|
27
|
+
{/await}
|
|
28
|
+
|
|
29
|
+
<style>p {font-family: 'Comic Sans MS', cursive;}</style>
|
|
@@ -129,6 +129,7 @@ module Rouge
|
|
|
129
129
|
|
|
130
130
|
disambiguate '*.cls' do
|
|
131
131
|
next TeX if matches?(/\A\s*(?:\\|%)/)
|
|
132
|
+
next OpenEdge if matches?(/(no\-undo|BLOCK\-LEVEL|ROUTINE\-LEVEL|&ANALYZE\-SUSPEND)/i)
|
|
132
133
|
next Apex
|
|
133
134
|
end
|
|
134
135
|
|
|
@@ -139,6 +140,12 @@ module Rouge
|
|
|
139
140
|
|
|
140
141
|
Puppet
|
|
141
142
|
end
|
|
143
|
+
|
|
144
|
+
disambiguate '*.p' do
|
|
145
|
+
next Prolog if contains?(':-')
|
|
146
|
+
next Prolog if matches?(/\A\w+(\(\w+\,\s*\w+\))*\./)
|
|
147
|
+
next OpenEdge
|
|
148
|
+
end
|
|
142
149
|
end
|
|
143
150
|
end
|
|
144
151
|
end
|
data/lib/rouge/lexers/bpf.rb
CHANGED
|
@@ -9,11 +9,11 @@ module Rouge
|
|
|
9
9
|
tag 'bpf'
|
|
10
10
|
|
|
11
11
|
TYPE_KEYWORDS = %w(
|
|
12
|
-
u8 u16 u32 u64 ll
|
|
12
|
+
u8 u16 u32 u64 s8 s16 s32 s64 ll
|
|
13
13
|
).join('|')
|
|
14
14
|
|
|
15
15
|
MISC_KEYWORDS = %w(
|
|
16
|
-
be16 be32 be64 exit lock map
|
|
16
|
+
be16 be32 be64 le16 le32 le64 bswap16 bswap32 bswap64 exit lock map
|
|
17
17
|
).join('|')
|
|
18
18
|
|
|
19
19
|
state :root do
|
|
@@ -32,21 +32,21 @@ module Rouge
|
|
|
32
32
|
rule %r/(call)(\s+)(\d+)/i do
|
|
33
33
|
groups Keyword, Text::Whitespace, Literal::Number::Integer
|
|
34
34
|
end
|
|
35
|
-
rule %r/(call)(\s+)(\w+)(#)(\d+)
|
|
35
|
+
rule %r/(call)(\s+)(\w+)(?:(#)(\d+))?/i do
|
|
36
36
|
groups Keyword, Text::Whitespace, Name::Builtin, Punctuation, Literal::Number::Integer
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Unconditional jumps
|
|
40
|
-
rule %r/(
|
|
41
|
-
groups Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
40
|
+
rule %r/(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
|
41
|
+
groups Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Conditional jumps
|
|
45
|
-
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(
|
|
46
|
-
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
45
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
|
46
|
+
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
47
47
|
end
|
|
48
|
-
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)([rw]\d+)(\s*)(
|
|
49
|
-
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
48
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)([rw]\d+)(\s*)(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
|
49
|
+
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Dereferences
|
|
@@ -70,7 +70,7 @@ module Rouge
|
|
|
70
70
|
rule %r/#{MISC_KEYWORDS}/i, Keyword
|
|
71
71
|
|
|
72
72
|
# Literals and global objects (maps) refered by name
|
|
73
|
-
rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
|
73
|
+
rule %r/([-]?0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
|
74
74
|
groups Literal::Number, Text::Whitespace, Keyword::Type
|
|
75
75
|
end
|
|
76
76
|
rule %r/(\w+)(\s*)(ll)/i do
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Rouge
|
|
5
|
+
module Lexers
|
|
6
|
+
class Codeowners < RegexLexer
|
|
7
|
+
title 'CODEOWNERS'
|
|
8
|
+
desc 'Code Owners syntax (https://docs.gitlab.com/ee/user/project/codeowners/reference.html)'
|
|
9
|
+
tag 'codeowners'
|
|
10
|
+
filenames 'CODEOWNERS'
|
|
11
|
+
|
|
12
|
+
state :root do
|
|
13
|
+
rule %r/[ \t\r\n]+/, Text::Whitespace
|
|
14
|
+
rule %r/^\s*#.*$/, Comment::Single
|
|
15
|
+
|
|
16
|
+
rule %r(
|
|
17
|
+
(\^?\[(?!\d+\])[^\]]+\])
|
|
18
|
+
(\[\d+\])?
|
|
19
|
+
)x do
|
|
20
|
+
groups Name::Namespace, Literal::Number
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
rule %r/\S*@\S+/, Name::Function
|
|
24
|
+
|
|
25
|
+
rule %r/[\p{Word}\.\/\-\*]+/, Name
|
|
26
|
+
rule %r/.*\\[\#\s]/, Name
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/rouge/lexers/dart.rb
CHANGED
|
@@ -12,16 +12,16 @@ module Rouge
|
|
|
12
12
|
mimetypes 'text/x-dart'
|
|
13
13
|
|
|
14
14
|
keywords = %w(
|
|
15
|
-
as assert await break case catch continue default do else finally for
|
|
16
|
-
|
|
15
|
+
as assert await break case catch continue default do else finally for if
|
|
16
|
+
in is new rethrow return super switch this throw try while when with yield
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
declarations = %w(
|
|
20
|
-
abstract async dynamic const covariant external extends factory final get
|
|
21
|
-
|
|
20
|
+
abstract base async dynamic const covariant external extends factory final get implements
|
|
21
|
+
interface late native on operator required sealed set static sync typedef var
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
types = %w(bool Comparable double Dynamic enum Function int List Map Never Null num Object Pattern Set String Symbol Type Uri void)
|
|
24
|
+
types = %w(bool Comparable double Dynamic enum Function int List Map Never Null num Object Pattern Record Set String Symbol Type Uri void)
|
|
25
25
|
|
|
26
26
|
imports = %w(import deferred export library part\s*of part source)
|
|
27
27
|
|
|
@@ -53,7 +53,7 @@ module Rouge
|
|
|
53
53
|
rule %r/(?:#{declarations.join('|')})\b/, Keyword::Declaration
|
|
54
54
|
rule %r/(?:#{types.join('|')})\b/, Keyword::Type
|
|
55
55
|
rule %r/(?:true|false|null)\b/, Keyword::Constant
|
|
56
|
-
rule %r/(?:class|
|
|
56
|
+
rule %r/(?:class|mixin)\b/, Keyword::Declaration, :class
|
|
57
57
|
rule %r/(?:#{imports.join('|')})\b/, Keyword::Namespace, :import
|
|
58
58
|
rule %r/(\.)(#{id})/ do
|
|
59
59
|
groups Operator, Name::Attribute
|
data/lib/rouge/lexers/dot.rb
CHANGED
data/lib/rouge/lexers/elixir.rb
CHANGED
data/lib/rouge/lexers/groovy.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Rouge
|
|
|
23
23
|
|
|
24
24
|
def self.declarations
|
|
25
25
|
@declarations ||= Set.new %w(
|
|
26
|
-
abstract const
|
|
26
|
+
abstract const extends final implements native private
|
|
27
27
|
protected public static strictfp super synchronized throws
|
|
28
28
|
transient volatile
|
|
29
29
|
)
|
|
@@ -31,7 +31,7 @@ module Rouge
|
|
|
31
31
|
|
|
32
32
|
def self.types
|
|
33
33
|
@types ||= Set.new %w(
|
|
34
|
-
def boolean byte char double float int long short void
|
|
34
|
+
def var boolean byte char double float int long short void
|
|
35
35
|
)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -56,7 +56,7 @@ module Rouge
|
|
|
56
56
|
rule %r(//.*?$), Comment::Single
|
|
57
57
|
rule %r(/[*].*?[*]/)m, Comment::Multiline
|
|
58
58
|
rule %r/@\w[\w.]*/, Name::Decorator
|
|
59
|
-
rule %r/(class|interface|trait)\b/, Keyword::Declaration, :class
|
|
59
|
+
rule %r/(class|interface|trait|enum|record)\b/, Keyword::Declaration, :class
|
|
60
60
|
rule %r/package\b/, Keyword::Namespace, :import
|
|
61
61
|
rule %r/import\b/, Keyword::Namespace, :import
|
|
62
62
|
|
data/lib/rouge/lexers/hcl.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Rouge
|
|
|
56
56
|
@builtins ||= %w()
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
id = /[$a-z_][a-z0-9_]*/io
|
|
59
|
+
id = /[$a-z_\-][a-z0-9_\-]*/io
|
|
60
60
|
|
|
61
61
|
state :root do
|
|
62
62
|
mixin :comments_and_whitespace
|
|
@@ -114,6 +114,7 @@ module Rouge
|
|
|
114
114
|
state :hash do
|
|
115
115
|
mixin :comments_and_whitespace
|
|
116
116
|
|
|
117
|
+
rule %r/[.,()\\\/*]/, Punctuation
|
|
117
118
|
rule %r/\=/, Punctuation
|
|
118
119
|
rule %r/\}/, Punctuation, :pop!
|
|
119
120
|
|
|
@@ -123,7 +124,7 @@ module Rouge
|
|
|
123
124
|
state :array do
|
|
124
125
|
mixin :comments_and_whitespace
|
|
125
126
|
|
|
126
|
-
rule %r
|
|
127
|
+
rule %r/[.,()\\\/*]/, Punctuation
|
|
127
128
|
rule %r/\]/, Punctuation, :pop!
|
|
128
129
|
|
|
129
130
|
mixin :root
|
data/lib/rouge/lexers/irb.rb
CHANGED
|
@@ -190,7 +190,14 @@ module Rouge
|
|
|
190
190
|
|
|
191
191
|
rule %r/function(?=(\(.*\)))/, Keyword::Declaration # For anonymous functions
|
|
192
192
|
|
|
193
|
-
rule %r/(#{id})[ \t]*(?=(\(.*\)))/m
|
|
193
|
+
rule %r/(#{id})[ \t]*(?=(\(.*\)))/m do |m|
|
|
194
|
+
if self.class.keywords.include? m[1]
|
|
195
|
+
# "if" in "if (...)" or "switch" in "switch (...)" are recognized as keywords.
|
|
196
|
+
token Keyword
|
|
197
|
+
else
|
|
198
|
+
token Name::Function
|
|
199
|
+
end
|
|
200
|
+
end
|
|
194
201
|
|
|
195
202
|
rule %r/[{}]/, Punctuation, :statement
|
|
196
203
|
|
data/lib/rouge/lexers/jinja.rb
CHANGED
|
@@ -14,25 +14,25 @@ module Rouge
|
|
|
14
14
|
'text/html+django', 'text/html+jinja'
|
|
15
15
|
|
|
16
16
|
def self.keywords
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
@keywords ||= %w(as context do else extends from ignore missing
|
|
18
|
+
import include reversed recursive scoped
|
|
19
|
+
autoescape endautoescape block endblock call endcall
|
|
20
|
+
filter endfilter for endfor if endif macro endmacro
|
|
21
|
+
set endset trans endtrans with endwith without)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def self.tests
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
@tests ||= %w(callable defined divisibleby equalto escaped even iterable
|
|
26
|
+
lower mapping none number odd sameas sequence string
|
|
27
|
+
undefined upper)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def self.pseudo_keywords
|
|
31
|
-
|
|
31
|
+
@pseudo_keywords ||= %w(true false none True False None)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def self.word_operators
|
|
35
|
-
|
|
35
|
+
@word_operators ||= %w(is in and or not)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
state :root do
|