mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Don't pass JSON-files through csonc
This commit is contained in:
committed by
Florian Schäfer
parent
e8e82a1ca3
commit
417171cfe1
@@ -148,10 +148,12 @@ def load_grammar(path)
|
|||||||
case File.extname(path.downcase)
|
case File.extname(path.downcase)
|
||||||
when '.plist', '.tmlanguage'
|
when '.plist', '.tmlanguage'
|
||||||
Plist::parse_xml(path)
|
Plist::parse_xml(path)
|
||||||
when '.cson', '.json'
|
when '.cson'
|
||||||
cson = `"#{CSONC}" "#{path}"`
|
cson = `"#{CSONC}" "#{path}"`
|
||||||
raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success?
|
raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success?
|
||||||
JSON.parse(cson)
|
JSON.parse(cson)
|
||||||
|
when '.json'
|
||||||
|
JSON.parse(File.read(path))
|
||||||
else
|
else
|
||||||
raise "Invalid document type #{path}"
|
raise "Invalid document type #{path}"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user