diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build | 18 | ||||
-rw-r--r-- | scripts/test_extensions.vim | 26 | ||||
-rw-r--r-- | scripts/test_filetypes.vim | 2 |
3 files changed, 38 insertions, 8 deletions
diff --git a/scripts/build b/scripts/build index f688c28f..67f01ca3 100755 --- a/scripts/build +++ b/scripts/build @@ -268,10 +268,6 @@ def rule_to_code(rule) end end - if rule.has_key?("rules") - return rule["rules"].map { |r| indent(rule_to_code(r), 0) }.join("\n") - end - if rule.has_key?("pattern") || rule.has_key?("or") || rule.has_key?("and") return <<~EOS if #{pattern_to_condition(rule)} @@ -280,6 +276,10 @@ def rule_to_code(rule) EOS end + if rule.has_key?("rules") + return rule["rules"].map { |r| indent(rule_to_code(r), 0) }.join("\n") + end + if rule.has_key?("if_set") return <<~EOS if #{rule["negative"] ? "!" : ""}#{rule["if_set"]} @@ -288,6 +288,14 @@ def rule_to_code(rule) EOS end + if rule.has_key?("if_exists") + return <<~EOS + if #{rule["negative"] ? "!" : ""}exists("#{rule["if_exists"]}") + #{indent(rule_to_code(except(rule, "if_exists", "negative")), 2)} + endif + EOS + end + if rule.has_key?("set") return <<~EOS let #{rule["set"]} = 1 @@ -455,7 +463,7 @@ def generate_ftdetect(packages, heuristics) extensions = filetype["extensions"] filenames = filetype["filenames"] - expected_extensions = all_filetypes.has_key?(name) ? all_filetypes.fetch(name)[:extensions] : [] + expected_extensions = (all_filetypes.has_key?(name) ? all_filetypes.fetch(name)[:extensions] : []).map(&:downcase) ignored_extensions = expand_all(filetype.fetch("ignored_extensions", [])) ignored_warnings = expand_all(filetype.fetch("ignored_warnings", [])) diff --git a/scripts/test_extensions.vim b/scripts/test_extensions.vim index 9cac0b21..f2aaf66c 100644 --- a/scripts/test_extensions.vim +++ b/scripts/test_extensions.vim @@ -181,6 +181,18 @@ call TestExtension("ave", "foobar.ave", "") " Awk call TestExtension("awk", "foobar.awk", "") +" C++ +call TestExtension("c", "foobar.c", "") +call TestExtension("cpp", "foobar.cxx", "") +call TestExtension("cpp", "foobar.c++", "") +call TestExtension("cpp", "foobar.hh", "") +call TestExtension("cpp", "foobar.hxx", "") +call TestExtension("cpp", "foobar.hpp", "") +call TestExtension("cpp", "foobar.ipp", "") +call TestExtension("cpp", "foobar.moc", "") +call TestExtension("cpp", "foobar.tcc", "") +call TestExtension("cpp", "foobar.inl", "") + " vim-polyglot only call TestExtension("blade", "test.blade.php", "") call TestExtension("yaml.ansible", "playbook.yml", "") @@ -233,7 +245,7 @@ call TestExtension("vb", "vb.dsm", "") call TestExtension("vb", "vb.dsm", "") call TestExtension("vb", "vb.ctl", "") -" Idris +" .idr extension call TestExtension("idris", "lowercase.idr", "--idris1") call TestExtension("idris", "uppercase.idr", "--Idris1") call TestExtension("idris", "start-space-l.idr", "-- idris1") @@ -253,7 +265,17 @@ call TestExtension("idris2", "two-spaces-u.idr", "-- Idris 2") call TestExtension("idris2", "mypkg.ipkg", "package mypkg\n\ndepends = effects") call TestExtension("idris2", "use-post-proj.idr", "%language PostfixProjections") -" Literate Idris +" .lidr extension call TestExtension("lidris", "lidris-1.lidr", "Some test plaintext\n\n> --idris1\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") call TestExtension("lidris2", "lidris-2.lidr", "Some test plaintext\n\n> --idris2\n> myfact : Nat -> Nat\n> myfact Z = 1\n> myfact (S k) = (S k) * myfact k\n\nMore plaintext") + +" .h extension +call TestExtension("objcpp", "foo.h", "@interface MTNavigationController : UINavigationController") +call TestExtension("cpp", "foo.h", "") +let g:c_syntax_for_h = 1 +call TestExtension("objc", "foo.h", "@interface MTNavigationController : UINavigationController") +call TestExtension("c", "foo.h", "") +unlet g:c_syntax_for_h +let g:ch_syntax_for_h = 1 +call TestExtension("ch", "foo.h", "") diff --git a/scripts/test_filetypes.vim b/scripts/test_filetypes.vim index e157889d..42e683d1 100644 --- a/scripts/test_filetypes.vim +++ b/scripts/test_filetypes.vim @@ -45,8 +45,8 @@ call TestFiletype('autoit') call TestFiletype('ave') call TestFiletype('awk') call TestFiletype('reason') -call TestFiletype('c') call TestFiletype('cpp') +call TestFiletype('c') call TestFiletype('caddyfile') call TestFiletype('carp') call TestFiletype('clojure') |