From d063089430491fa6398ecebbe0ef7936634f34ea Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Fri, 20 Jul 2012 14:45:19 -0500 Subject: [PATCH] Add coq comments --- lib/linguist/tokenizer.rb | 6 ++++++ test/test_tokenizer.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/linguist/tokenizer.rb b/lib/linguist/tokenizer.rb index bf5fa388..a8afe676 100644 --- a/lib/linguist/tokenizer.rb +++ b/lib/linguist/tokenizer.rb @@ -72,6 +72,12 @@ module Linguist s.skip_until(/-->/) tokens << "-->" + # Coq multiline comments + elsif token = s.scan(/\(\*/) + tokens << "(*" + s.skip_until(/\*\)/) + tokens << "*)" + # Skip single or double quoted strings elsif s.scan(/"/) s.skip_until(/[^\\]"/) diff --git a/test/test_tokenizer.rb b/test/test_tokenizer.rb index 72693cff..e757c7d7 100644 --- a/test/test_tokenizer.rb +++ b/test/test_tokenizer.rb @@ -36,6 +36,7 @@ class TestTokenizer < Test::Unit::TestCase assert_equal %w(foo /* */), tokenize("foo /* \nComment\n */") assert_equal %w(foo ), tokenize("foo ") assert_equal %w(foo {- -}), tokenize("foo {- Comment -}") + assert_equal %w(foo \(* *\)), tokenize("foo (* Comment *)") assert_equal %w(% %), tokenize("2 % 10\n% Comment") end