diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/build | 14 | ||||
| -rw-r--r-- | scripts/test_extensions.vim | 7 | ||||
| -rw-r--r-- | scripts/test_filetypes.vim | 2 | 
3 files changed, 19 insertions, 4 deletions
| diff --git a/scripts/build b/scripts/build index 384c8423..1fe148e7 100755 --- a/scripts/build +++ b/scripts/build @@ -202,9 +202,17 @@ def indent(str, amount)  end  def pattern_to_condition(rule) +  if rule.has_key?("or") +    return rule["or"].map { |p| pattern_to_condition(p) }.join(" || ") +  end + +  if rule.has_key?("or") +    return rule["and"].map { |p| pattern_to_condition(p) }.join(" && ") +  end +    operator = (rule["negative"] ? "!" : "=") + "~" + (rule["ignore_case"] ? "?" : "#") -  "line #{operator} '#{rule["pattern"]}'" +  return "line #{operator} '#{rule["pattern"]}'"  end  def rules_to_code(rules) @@ -250,10 +258,10 @@ def rule_to_code(rule)      return rule["rules"].map { |r| indent(rule_to_code(r), 0) }.join("\n")    end -  if rule.has_key?("pattern") +  if rule.has_key?("pattern") || rule.has_key?("or") || rule.has_key?("and")      return <<~EOS        if #{pattern_to_condition(rule)} -      #{indent(rule_to_code(except(rule, "pattern", "ignore_case", "negative")), 2)} +      #{indent(rule_to_code(except(rule, "pattern", "or", "and", "ignore_case", "negative")), 2)}        endif      EOS    end diff --git a/scripts/test_extensions.vim b/scripts/test_extensions.vim index cb52bef8..dfe2f3a3 100644 --- a/scripts/test_extensions.vim +++ b/scripts/test_extensions.vim @@ -207,3 +207,10 @@ call TestExtension('fsharp', 'fsharp.fs', "let myInt = 5")  call TestExtension('glsl', 'glsl.fs', "//#version 120\nvoid main() {}")  let g:filetype_fs = 'fizfuz'  call TestExtension('fizfuz', 'fizfuz.fs', '') + +" .re extension +call TestExtension('reason', 'empty.re', '') +call TestExtension('cpp', 'cpp.re', '#include "config.h"') +call TestExtension('cpp', 'cpp2.re', '#ifdef HAVE_CONFIG_H') +call TestExtension('cpp', 'cpp3.re', '#define YYCTYPE unsigned char') +call TestExtension('reason', 'react.re', 'ReasonReact.Router.push("");') diff --git a/scripts/test_filetypes.vim b/scripts/test_filetypes.vim index 86e2ff36..d0bec4cc 100644 --- a/scripts/test_filetypes.vim +++ b/scripts/test_filetypes.vim @@ -44,6 +44,7 @@ call TestFiletype('atlas')  call TestFiletype('autoit')  call TestFiletype('ave')  call TestFiletype('awk') +call TestFiletype('reason')  call TestFiletype('c')  call TestFiletype('cpp')  call TestFiletype('caddyfile') @@ -175,7 +176,6 @@ call TestFiletype('ragel')  call TestFiletype('raku')  call TestFiletype('raml')  call TestFiletype('razor') -call TestFiletype('reason')  call TestFiletype('rst')  call TestFiletype('ruby')  call TestFiletype('eruby') | 
