mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-17 14:55:41 +00:00
Add Jison-generated JavaScript to generated files (#3393)
* Fix typos * Add Jison-generated JavaScript to generated files
This commit is contained in:
committed by
Brandon Black
parent
e1ce88920d
commit
48e4394d87
@@ -3,7 +3,7 @@ module Linguist
|
||||
# Public: Is the blob a generated file?
|
||||
#
|
||||
# name - String filename
|
||||
# data - String blob data. A block also maybe passed in for lazy
|
||||
# data - String blob data. A block also may be passed in for lazy
|
||||
# loading. This behavior is deprecated and you should always
|
||||
# pass in a String.
|
||||
#
|
||||
@@ -78,7 +78,8 @@ module Linguist
|
||||
generated_racc? ||
|
||||
generated_jflex? ||
|
||||
generated_grammarkit? ||
|
||||
generated_roxygen2?
|
||||
generated_roxygen2? ||
|
||||
generated_jison?
|
||||
end
|
||||
|
||||
# Internal: Is the blob an Xcode file?
|
||||
@@ -312,7 +313,7 @@ module Linguist
|
||||
!!name.match(/vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)/)
|
||||
end
|
||||
|
||||
# Internal: Is the blob a generated npm shrinkwrap file.
|
||||
# Internal: Is the blob a generated npm shrinkwrap file?
|
||||
#
|
||||
# Returns true or false.
|
||||
def npm_shrinkwrap?
|
||||
@@ -334,7 +335,7 @@ module Linguist
|
||||
!!name.match(/composer\.lock/)
|
||||
end
|
||||
|
||||
# Internal: Is the blob a generated by Zephir
|
||||
# Internal: Is the blob generated by Zephir?
|
||||
#
|
||||
# Returns true or false.
|
||||
def generated_by_zephir?
|
||||
@@ -434,7 +435,7 @@ module Linguist
|
||||
return false unless lines.count > 1
|
||||
return lines[0].start_with?("// This is a generated file. Not intended for manual editing.")
|
||||
end
|
||||
|
||||
|
||||
# Internal: Is this a roxygen2-generated file?
|
||||
#
|
||||
# A roxygen2-generated file typically contain:
|
||||
@@ -448,5 +449,23 @@ module Linguist
|
||||
|
||||
return lines[0].include?("% Generated by roxygen2: do not edit by hand")
|
||||
end
|
||||
|
||||
# Internal: Is this a Jison-generated file?
|
||||
#
|
||||
# Jison-generated parsers typically contain:
|
||||
# /* parser generated by jison
|
||||
# on the first line.
|
||||
#
|
||||
# Jison-generated lexers typically contain:
|
||||
# /* generated by jison-lex
|
||||
# on the first line.
|
||||
#
|
||||
# Return true or false
|
||||
def generated_jison?
|
||||
return false unless extname == '.js'
|
||||
return false unless lines.count > 1
|
||||
return lines[0].start_with?("/* parser generated by jison ") ||
|
||||
lines[0].start_with?("/* generated by jison-lex ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user