Merge pull request #1723 from techhat/pythonmultiline

Python also supports triple single-quotes for comments
This commit is contained in:
Arfon Smith
2015-01-24 10:54:30 -06:00
2 changed files with 4 additions and 1 deletions

View File

@@ -33,7 +33,8 @@ module Linguist
['<!--', '-->'], # XML ['<!--', '-->'], # XML
['{-', '-}'], # Haskell ['{-', '-}'], # Haskell
['(*', '*)'], # Coq ['(*', '*)'], # Coq
['"""', '"""'] # Python ['"""', '"""'], # Python
["'''", "'''"] # Python
] ]
START_SINGLE_LINE_COMMENT = Regexp.compile(SINGLE_LINE_COMMENTS.map { |c| START_SINGLE_LINE_COMMENT = Regexp.compile(SINGLE_LINE_COMMENTS.map { |c|

View File

@@ -41,6 +41,8 @@ class TestTokenizer < Minitest::Test
assert_equal %w(foo), tokenize("foo {- Comment -}") assert_equal %w(foo), tokenize("foo {- Comment -}")
assert_equal %w(foo), tokenize("foo (* Comment *)") assert_equal %w(foo), tokenize("foo (* Comment *)")
assert_equal %w(%), tokenize("2 % 10\n% Comment") assert_equal %w(%), tokenize("2 % 10\n% Comment")
assert_equal %w(foo bar), tokenize("foo\n\"\"\"\nComment\n\"\"\"\nbar")
assert_equal %w(foo bar), tokenize("foo\n'''\nComment\n'''\nbar")
end end
def test_sgml_tags def test_sgml_tags