Skip to content

Commit 2f130c9

Browse files
authored
Fix code indentation on Bicep lexer (#2138)
1 parent dbbab31 commit 2f130c9

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

lib/rouge/lexers/bicep.rb

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,44 @@ def self.functions
3737
punctuations = %w(( ) { } [ ] , : ; = .)
3838

3939
state :root do
40-
mixin :comments
41-
42-
# Match strings
43-
rule %r/'/, Str::Single, :string
44-
45-
# Match numbers
46-
rule %r/\b\d+\b/, Num
47-
48-
# Rules for sets of reserved keywords
49-
rule %r/\b\w+\b/ do |m|
50-
if self.class.keywords.include? m[0]
51-
token Keyword
52-
elsif self.class.datatypes.include? m[0]
53-
token Keyword::Type
54-
elsif self.class.functions.include? m[0]
55-
token Name::Function
56-
else
57-
token Name
58-
end
40+
mixin :comments
41+
42+
# Match strings
43+
rule %r/'/, Str::Single, :string
44+
45+
# Match numbers
46+
rule %r/\b\d+\b/, Num
47+
48+
# Rules for sets of reserved keywords
49+
rule %r/\b\w+\b/ do |m|
50+
if self.class.keywords.include? m[0]
51+
token Keyword
52+
elsif self.class.datatypes.include? m[0]
53+
token Keyword::Type
54+
elsif self.class.functions.include? m[0]
55+
token Name::Function
56+
else
57+
token Name
5958
end
59+
end
6060

61-
# Match operators
62-
rule %r/#{operators.map { |o| Regexp.escape(o) }.join('|')}/, Operator
61+
# Match operators
62+
rule %r/#{operators.map { |o| Regexp.escape(o) }.join('|')}/, Operator
6363

64-
# Enter a state when encountering an opening curly bracket
65-
rule %r/{/, Punctuation::Indicator, :block
64+
# Enter a state when encountering an opening curly bracket
65+
rule %r/{/, Punctuation::Indicator, :block
6666

67-
# Match punctuation
68-
rule %r/#{punctuations.map { |p| Regexp.escape(p) }.join('|')}/, Punctuation
67+
# Match punctuation
68+
rule %r/#{punctuations.map { |p| Regexp.escape(p) }.join('|')}/, Punctuation
6969

70-
# Match identifiers
71-
rule %r/[a-zA-Z_]\w*/, Name
70+
# Match identifiers
71+
rule %r/[a-zA-Z_]\w*/, Name
7272

73-
# Match decorators
74-
rule %r/@[a-zA-Z_]\w*/, Name::Decorator
73+
# Match decorators
74+
rule %r/@[a-zA-Z_]\w*/, Name::Decorator
7575

76-
# Ignore whitespace
77-
rule %r/\s+/, Text
76+
# Ignore whitespace
77+
rule %r/\s+/, Text
7878
end
7979

8080
state :comments do
@@ -89,7 +89,7 @@ def self.functions
8989
rule %r/\'/, Str::Single, :pop!
9090
rule %r/\$+/, Str::Single
9191
end
92-
92+
9393
state :interp do
9494
rule %r/\}/, Str::Interpol, :pop!
9595
mixin :root

spec/lexers/bicep_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# frozen_string_literal: true
33

44
describe Rouge::Lexers::Bicep do
5-
let(:subject) { Rouge::Lexers::Bicep.new }
5+
let(:subject) { Rouge::Lexers::Bicep.new }
66

7-
describe 'guessing' do
8-
include Support::Guessing
9-
10-
it 'guesses by filename' do
11-
assert_guess :filename => 'foo.bicep'
12-
deny_guess :filename => 'foo'
13-
end
7+
describe 'guessing' do
8+
include Support::Guessing
9+
10+
it 'guesses by filename' do
11+
assert_guess :filename => 'foo.bicep'
12+
deny_guess :filename => 'foo'
1413
end
1514
end
15+
end

0 commit comments

Comments
 (0)