Skip to content

Commit 7ef6f77

Browse files
committed
add support for raw strings in Go
1 parent afa2be7 commit 7ef6f77

File tree

1 file changed

+8
-1
lines changed
  • lib/coderay/scanners

1 file changed

+8
-1
lines changed

lib/coderay/scanners/go.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ def scan_tokens encoder, options
103103
end
104104
encoder.text_token match, :delimiter
105105
state = :string
106-
106+
107+
elsif match = scan(/ ` ([^`]+)? (`)? /x)
108+
encoder.begin_group :shell
109+
encoder.text_token '`', :delimiter
110+
encoder.text_token self[1], :content if self[1]
111+
encoder.text_token self[2], :delimiter if self[2]
112+
encoder.end_group :shell
113+
107114
elsif match = scan(/ \# \s* if \s* 0 /x)
108115
match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos?
109116
encoder.text_token match, :comment

0 commit comments

Comments
 (0)