lib/linguist/generated.rb in github-linguist-4.7.4 vs lib/linguist/generated.rb in github-linguist-4.7.5

- old
+ new

@@ -70,11 +70,13 @@ generated_apache_thrift? || generated_jni_header? || vcr_cassette? || generated_module? || generated_unity3d_meta? || - generated_racc? + generated_racc? || + generated_jflex? || + generated_grammarkit? end # Internal: Is the blob an Xcode file? # # Generated if the file extension is an Xcode @@ -370,8 +372,35 @@ # Return true or false def generated_racc? return false unless extname == '.rb' return false unless lines.count > 2 return lines[2].start_with?("# This file is automatically generated by Racc") + end + + # Internal: Is this a JFlex-generated file? + # + # A JFlex-generated file contains: + # /* The following code was generated by JFlex x.y.z on d/at/e ti:me */ + # on the first line. + # + # Return true or false + def generated_jflex? + return false unless extname == '.java' + return false unless lines.count > 1 + return lines[0].start_with?("/* The following code was generated by JFlex ") + end + + # Internal: Is this a GrammarKit-generated file? + # + # A GrammarKit-generated file typically contain: + # // This is a generated file. Not intended for manual editing. + # on the first line. This is not always the case, as it's possible to + # customize the class header. + # + # Return true or false + def generated_grammarkit? + return false unless extname == '.java' + return false unless lines.count > 1 + return lines[0].start_with?("// This is a generated file. Not intended for manual editing.") end end end