github-linguist 7.14.0 → 7.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/bin/github-linguist +115 -71
  3. data/grammars/annotation.liquidhaskell.haskell.json +1 -1
  4. data/grammars/etc.json +1 -1
  5. data/grammars/go.mod.json +1 -0
  6. data/grammars/go.sum.json +1 -0
  7. data/grammars/hint.haskell.json +1 -1
  8. data/grammars/hint.message.haskell.json +1 -1
  9. data/grammars/hint.type.haskell.json +1 -1
  10. data/grammars/markdown.bicep.codeblock.json +1 -0
  11. data/grammars/markdown.codeblock.proto.json +1 -0
  12. data/grammars/markdown.mcfunction.codeblock.json +1 -0
  13. data/grammars/source.abap.json +1 -1
  14. data/grammars/source.aidl.json +1 -0
  15. data/grammars/source.al.json +1 -1
  16. data/grammars/source.angelscript.json +1 -1
  17. data/grammars/source.avro.json +1 -1
  18. data/grammars/source.ballerina.json +1 -1
  19. data/grammars/source.batchfile.json +1 -1
  20. data/grammars/source.bc.json +1 -0
  21. data/grammars/source.bicep.json +1 -1
  22. data/grammars/source.boo.json +1 -1
  23. data/grammars/source.bp.json +1 -0
  24. data/grammars/source.cil.json +1 -0
  25. data/grammars/source.cirru.json +1 -1
  26. data/grammars/source.cs.json +1 -1
  27. data/grammars/source.csound.json +1 -1
  28. data/grammars/source.css.json +1 -1
  29. data/grammars/source.cue.json +1 -0
  30. data/grammars/source.cuesheet.json +1 -0
  31. data/grammars/source.dart.json +1 -1
  32. data/grammars/source.dc.json +1 -0
  33. data/grammars/source.ditroff.json +1 -1
  34. data/grammars/source.dotenv.json +1 -0
  35. data/grammars/source.ebnf.json +1 -1
  36. data/grammars/source.ecl.json +1 -0
  37. data/grammars/source.ed.json +1 -0
  38. data/grammars/source.fnl.json +1 -0
  39. data/grammars/source.fontforge.json +1 -1
  40. data/grammars/source.fstar.json +1 -1
  41. data/grammars/source.ftl.json +1 -0
  42. data/grammars/source.gcode.json +1 -1
  43. data/grammars/source.gdscript.json +1 -1
  44. data/grammars/source.hack.json +1 -1
  45. data/grammars/source.haskell.json +1 -1
  46. data/grammars/source.hlcode.json +1 -0
  47. data/grammars/source.hsig.json +1 -1
  48. data/grammars/source.hx.json +1 -1
  49. data/grammars/source.hy.json +1 -1
  50. data/grammars/source.jest.snap.json +1 -0
  51. data/grammars/source.jq.json +1 -1
  52. data/grammars/source.json.json +1 -1
  53. data/grammars/source.julia.json +1 -1
  54. data/grammars/source.kakscript.json +1 -0
  55. data/grammars/source.keyvalues.json +1 -0
  56. data/grammars/source.kotlin.json +1 -1
  57. data/grammars/source.lean.json +1 -1
  58. data/grammars/source.m2.json +1 -1
  59. data/grammars/source.matlab.json +1 -1
  60. data/grammars/source.mcfunction.json +1 -1
  61. data/grammars/source.odin.json +1 -1
  62. data/grammars/source.opentype.json +1 -1
  63. data/grammars/source.pegjs.json +1 -0
  64. data/grammars/source.postscript.json +1 -1
  65. data/grammars/source.powershell.json +1 -1
  66. data/grammars/source.proto.json +1 -0
  67. data/grammars/source.purescript.json +1 -1
  68. data/grammars/source.regexp.json +1 -1
  69. data/grammars/source.regexp.oniguruma.json +1 -0
  70. data/grammars/source.rego.json +1 -1
  71. data/grammars/source.renpy.json +1 -1
  72. data/grammars/source.rescript.json +1 -1
  73. data/grammars/source.sed.json +1 -1
  74. data/grammars/source.sepolicy.json +1 -0
  75. data/grammars/source.shellcheckrc.json +1 -0
  76. data/grammars/source.sqf.json +1 -1
  77. data/grammars/source.swift.json +1 -1
  78. data/grammars/source.sy.json +1 -1
  79. data/grammars/source.tm-properties.json +1 -0
  80. data/grammars/source.ts.json +1 -1
  81. data/grammars/source.tsx.json +1 -1
  82. data/grammars/source.v.json +1 -1
  83. data/grammars/source.viml.json +1 -1
  84. data/grammars/source.webassembly.json +1 -1
  85. data/grammars/source.ws.json +1 -0
  86. data/grammars/source.wsd.json +1 -1
  87. data/grammars/source.xojo.json +1 -1
  88. data/grammars/source.yara.json +1 -1
  89. data/grammars/source.yasnippet.json +1 -1
  90. data/grammars/source.zig.json +1 -1
  91. data/grammars/text.html.astro.json +1 -0
  92. data/grammars/text.html.markdown.astro.json +1 -0
  93. data/grammars/text.info.json +1 -0
  94. data/grammars/text.lesshst.json +1 -0
  95. data/grammars/text.marko.json +1 -1
  96. data/grammars/text.sfd.json +1 -1
  97. data/grammars/text.tex.latex.haskell.json +1 -1
  98. data/grammars/text.xml.svg.json +1 -1
  99. data/grammars/textmate.format-string.json +1 -0
  100. data/grammars/version +1 -1
  101. data/lib/linguist/VERSION +1 -1
  102. data/lib/linguist/documentation.yml +1 -0
  103. data/lib/linguist/generated.rb +13 -0
  104. data/lib/linguist/heuristics.rb +6 -2
  105. data/lib/linguist/heuristics.yml +18 -4
  106. data/lib/linguist/language.rb +6 -3
  107. data/lib/linguist/languages.json +1 -1
  108. data/lib/linguist/languages.yml +385 -43
  109. data/lib/linguist/linguist.bundle +0 -0
  110. data/lib/linguist/linguist.so +0 -0
  111. data/lib/linguist/repository.rb +7 -3
  112. data/lib/linguist/samples.json +1 -1
  113. data/lib/linguist/shebang.rb +4 -1
  114. data/lib/linguist/strategy/modeline.rb +4 -0
  115. data/lib/linguist/vendor.yml +3 -0
  116. metadata +36 -5
  117. data/grammars/source.SASLog.json +0 -1
  118. data/grammars/source.mcfunction-snapshot.json +0 -1
  119. data/grammars/source.protobuf.json +0 -1
@@ -46,7 +46,7 @@ module Linguist
46
46
  return
47
47
  end
48
48
 
49
- data = YAML.load_file(File.expand_path("../heuristics.yml", __FILE__))
49
+ data = self.load_config
50
50
  named_patterns = data['named_patterns'].map { |k,v| [k, self.to_regex(v)] }.to_h
51
51
 
52
52
  data['disambiguations'].each do |disambiguation|
@@ -60,6 +60,10 @@ module Linguist
60
60
  end
61
61
  end
62
62
 
63
+ def self.load_config
64
+ YAML.load_file(File.expand_path("../heuristics.yml", __FILE__))
65
+ end
66
+
63
67
  def self.parse_rule(named_patterns, rule)
64
68
  if !rule['and'].nil?
65
69
  rules = rule['and'].map { |block| self.parse_rule(named_patterns, block) }
@@ -160,6 +164,6 @@ module Linguist
160
164
  def match(input)
161
165
  return !@pat.match(input)
162
166
  end
163
-
167
+
164
168
  end
165
169
  end
@@ -200,6 +200,12 @@ disambiguations:
200
200
  pattern: '^\s*(#version|precision|uniform|varying|vec[234])'
201
201
  - language: Filterscript
202
202
  pattern: '#include|#pragma\s+(rs|version)|__attribute__'
203
+ - extensions: ['.ftl']
204
+ rules:
205
+ - language: FreeMarker
206
+ pattern: '^(?:<|[a-zA-Z-][a-zA-Z0-9_-]+[ \t]+\w)|\${\w+[^\n]*?}|^[ \t]*(?:<#--.*?-->|<#([a-z]+)(?=\s|>)[^>]*>.*?</#\1>|\[#--.*?--\]|\[#([a-z]+)(?=\s|\])[^\]]*\].*?\[#\2\])'
207
+ - language: Fluent
208
+ pattern: '^-?[a-zA-Z][a-zA-Z0-9_-]* *=|\{\$-?[a-zA-Z][-\w]*(?:\.[a-zA-Z][-\w]*)?\}'
203
209
  - extensions: ['.gd']
204
210
  rules:
205
211
  - language: GAP
@@ -229,6 +235,7 @@ disambiguations:
229
235
  named_pattern: objectivec
230
236
  - language: C++
231
237
  named_pattern: cpp
238
+ - language: C
232
239
  - extensions: ['.hh']
233
240
  rules:
234
241
  - language: Hack
@@ -251,7 +258,10 @@ disambiguations:
251
258
  - language: PHP
252
259
  pattern: '^<\?(?:php)?'
253
260
  - language: SourcePawn
254
- pattern: '^public\s+(?:SharedPlugin(?:\s+|:)__pl_\w+\s*=(?:\s*{)?|(?:void\s+)?__pl_\w+_SetNTVOptional\(\)(?:\s*{)?)'
261
+ pattern:
262
+ - '^public\s+(?:SharedPlugin(?:\s+|:)__pl_\w+\s*=(?:\s*{)?|(?:void\s+)?__pl_\w+_SetNTVOptional\(\)(?:\s*{)?)'
263
+ - '^methodmap\s+\w+\s+<\s+\w+'
264
+ - '^\s*MarkNativeAsOptional\s*\('
255
265
  - language: NASL
256
266
  pattern:
257
267
  - '^\s*include\s*\(\s*(?:"|'')[\\/\w\-\.:\s]+\.(?:nasl|inc)\s*(?:"|'')\s*\)\s*;'
@@ -261,6 +271,10 @@ disambiguations:
261
271
  - '^\s*(?:public\s+|private\s+|\s*)function\s+\w+\s*\([\w\s,]*\)\s*{'
262
272
  - language: POV-Ray SDL
263
273
  pattern: '^\s*#(declare|local|macro|while)\s'
274
+ - language: Pascal
275
+ pattern:
276
+ - '(?i:^\s*{\$(?:mode|ifdef|undef|define)[ ]+[a-z0-9_]+})'
277
+ - '^\s*end[.;]\s*$'
264
278
  - extensions: ['.l']
265
279
  rules:
266
280
  - language: Common Lisp
@@ -438,7 +452,7 @@ disambiguations:
438
452
  - pattern: '^[#!]'
439
453
  - language: INI
440
454
  named_pattern: key_equals_value
441
- - language: Java properties
455
+ - language: Java Properties
442
456
  pattern: '^[^#!][^:]*:'
443
457
  - extensions: ['.q']
444
458
  rules:
@@ -571,7 +585,7 @@ disambiguations:
571
585
  # The following RegExp is simply a collapsed and simplified form of the
572
586
  # VIM_MODELINE pattern in `./lib/linguist/strategy/modeline.rb`.
573
587
  - language: Vim Help File
574
- pattern: '(?:(?:[ \t]|^)vi(?:m[<=>]?\d+|m)?|[ \t]ex)(?=:(?=[ \t]*set?[ \t][^\n:]+:)|:(?![ \t]* set?[ \t]))(?:(?:[ \t]|[ \t]*:[ \t]*)\w*(?:[ \t]*=(?:[^\\[ \t]]|\\.)*)?)*[[ \t]:](?:filetype|ft|syntax)[ \t]*=help(?=[ \t]|:|$)'
588
+ pattern: '(?:(?:^|[ \t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \t]ex)(?=:(?=[ \t]*set?[ \t][^\r\n:]+:)|:(?![ \t]*set?[ \t]))(?:(?:[ \t]*:[ \t]*|[ \t])\w*(?:[ \t]*=(?:[^\\\s]|\\.)*)?)*[ \t:](?:filetype|ft|syntax)[ \t]*=(help)(?=$|\s|:)'
575
589
  # HACK: This is a contrived use of heuristics needed to address
576
590
  # an unusual edge-case. See https://git.io/JULye for discussion.
577
591
  - language: Text
@@ -585,7 +599,7 @@ disambiguations:
585
599
  pattern: '\$(?:if|else)[ \t]|^[ \t]*fn\s+[^\s()]+\(.*?\).*?\{|^[ \t]*for\s*\{'
586
600
  - extensions: ['.vba']
587
601
  rules:
588
- - language: Vim script
602
+ - language: Vim Script
589
603
  pattern: '^UseVimball'
590
604
  - language: VBA
591
605
  - extensions: ['.w']
@@ -32,8 +32,6 @@ module Linguist
32
32
  @interpreter_index = Hash.new { |h,k| h[k] = [] }
33
33
  @filename_index = Hash.new { |h,k| h[k] = [] }
34
34
 
35
- # Valid Languages types
36
- TYPES = [:data, :markup, :programming, :prose]
37
35
 
38
36
  # Detect languages by a specific type
39
37
  #
@@ -265,7 +263,7 @@ module Linguist
265
263
 
266
264
  # Set type
267
265
  @type = attributes[:type] ? attributes[:type].to_sym : nil
268
- if @type && !TYPES.include?(@type)
266
+ if @type && !get_types.include?(@type)
269
267
  raise ArgumentError, "invalid type: #{@type}"
270
268
  end
271
269
 
@@ -302,6 +300,11 @@ module Linguist
302
300
  end
303
301
  end
304
302
 
303
+ def get_types
304
+ # Valid Languages types
305
+ @types = [:data, :markup, :programming, :prose]
306
+ end
307
+
305
308
  # Public: Get proper name
306
309
  #
307
310
  # Examples