diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-01 23:02:36 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-01 23:02:36 +0200 | 
| commit | f2ef4cedecf554c0c9f0694f93df1d53a57bf70c (patch) | |
| tree | ee95ac48f56aee9607aa3c92fe478cf63f9c26b7 /scripts/build | |
| parent | 45c1923f43f2bb2e626fe910654d4395a0e50a04 (diff) | |
| download | vim-polyglot-f2ef4cedecf554c0c9f0694f93df1d53a57bf70c.tar.gz vim-polyglot-f2ef4cedecf554c0c9f0694f93df1d53a57bf70c.zip  | |
Fix reason filetype detection, closes #532v4.7.1
Diffstat (limited to 'scripts/build')
| -rwxr-xr-x | scripts/build | 14 | 
1 files changed, 11 insertions, 3 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  | 
