diff --git a/prism/templates/template.rb b/prism/templates/template.rb index 0a632e2b05..31257ef1a1 100755 --- a/prism/templates/template.rb +++ b/prism/templates/template.rb @@ -526,60 +526,50 @@ module Prism erb = read_template(template) extension = File.extname(filepath.gsub(".erb", "")) - heading = case extension - when ".rb" - <<~HEADING - # frozen_string_literal: true + heading = + case extension + when ".rb" + <<~HEADING + # frozen_string_literal: true - =begin - This file is generated by the templates/template.rb script and should not be - modified manually. See #{filepath} - if you are looking to modify the template - =end + =begin + This file is generated by the templates/template.rb script and should not be + modified manually. See #{filepath} + if you are looking to modify the template + =end -<<<<<<< HEAD - HEADING - when ".rbs" - <<~HEADING - # This file is generated by the templates/template.rb script and should not be - # modified manually. See #{filepath} - # if you are looking to modify the template + HEADING + when ".rbs" + <<~HEADING + # This file is generated by the templates/template.rb script and should not be + # modified manually. See #{filepath} + # if you are looking to modify the template - HEADING - when ".rbi" - <<~HEADING - # typed: strict + HEADING + when ".rbi" + <<~HEADING + # typed: strict - =begin - This file is generated by the templates/template.rb script and should not be - modified manually. See #{filepath} - if you are looking to modify the template - =end + =begin + This file is generated by the templates/template.rb script and should not be + modified manually. See #{filepath} + if you are looking to modify the template + =end - HEADING - else - <<~HEADING - /******************************************************************************/ - /* This file is generated by the templates/template.rb script and should not */ - /* be modified manually. See */ - /* #{filepath + " " * (74 - filepath.size) } */ - /* if you are looking to modify the */ - /* template */ - /******************************************************************************/ + HEADING + else + <<~HEADING + /******************************************************************************/ + /* This file is generated by the templates/template.rb script and should not */ + /* be modified manually. See */ + /* #{filepath + " " * (74 - filepath.size) } */ + /* if you are looking to modify the */ + /* template */ + /******************************************************************************/ - HEADING -======= - { - errors: config.fetch("errors").map { |name| Error.new(name) }, - warnings: config.fetch("warnings").map { |name| Warning.new(name) }, - nodes: config.fetch("nodes").map { |node| NodeType.new(node) }.sort_by(&:name), - tokens: config.fetch("tokens").map { |token| Token.new(token) }, - flags: config.fetch("flags").map { |flags| Flags.new(flags) } - } ->>>>>>> 35d292f929 (Expose types on diagnostics) - end + HEADING + end -<<<<<<< HEAD write_to ||= File.expand_path("../#{name}", __dir__) contents = heading + erb.result_with_hash(locals) @@ -615,6 +605,8 @@ module Prism config = YAML.load_file(File.expand_path("../config.yml", __dir__)) { + errors: config.fetch("errors").map { |name| Error.new(name) }, + warnings: config.fetch("warnings").map { |name| Warning.new(name) }, nodes: config.fetch("nodes").map { |node| NodeType.new(node) }.sort_by(&:name), tokens: config.fetch("tokens").map { |token| Token.new(token) }, flags: config.fetch("flags").map { |flags| Flags.new(flags) } @@ -626,6 +618,7 @@ module Prism TEMPLATES = [ "ext/prism/api_node.c", "include/prism/ast.h", + "include/prism/diagnostic.h", "javascript/src/deserialize.js", "javascript/src/nodes.js", "javascript/src/visitor.js", @@ -640,6 +633,7 @@ module Prism "lib/prism/node.rb", "lib/prism/serialize.rb", "lib/prism/visitor.rb", + "src/diagnostic.c", "src/node.c", "src/prettyprint.c", "src/serialize.c", @@ -654,40 +648,6 @@ module Prism "sig/prism/_private/dot_visitor.rbs" ] end -======= - TEMPLATES = [ - "ext/prism/api_node.c", - "include/prism/ast.h", - "include/prism/diagnostic.h", - "javascript/src/deserialize.js", - "javascript/src/nodes.js", - "javascript/src/visitor.js", - "java/org/prism/Loader.java", - "java/org/prism/Nodes.java", - "java/org/prism/AbstractNodeVisitor.java", - "lib/prism/compiler.rb", - "lib/prism/dispatcher.rb", - "lib/prism/dot_visitor.rb", - "lib/prism/dsl.rb", - "lib/prism/mutation_compiler.rb", - "lib/prism/node.rb", - "lib/prism/serialize.rb", - "lib/prism/visitor.rb", - "src/diagnostic.c", - "src/node.c", - "src/prettyprint.c", - "src/serialize.c", - "src/token_type.c", - "rbi/prism/node.rbi", - "rbi/prism/visitor.rbi", - "sig/prism.rbs", - "sig/prism/dsl.rbs", - "sig/prism/mutation_compiler.rbs", - "sig/prism/node.rbs", - "sig/prism/visitor.rbs", - "sig/prism/_private/dot_visitor.rbs" - ] ->>>>>>> 35d292f929 (Expose types on diagnostics) end if __FILE__ == $0