From 2bbb509e18b35aa92051a00ed32c1e828eb41add Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 29 Nov 2014 00:35:46 +0100 Subject: [PATCH] Complete parsing of .ino files --- AVRsack/BuildProject | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AVRsack/BuildProject b/AVRsack/BuildProject index 6a9cdd5..03d61d2 100755 --- a/AVRsack/BuildProject +++ b/AVRsack/BuildProject @@ -56,13 +56,19 @@ def parseInoFiles proto = [] prototypes.scan(/[\w\[\]\*]+\s+[&\[\]\*\w\s]+\([&,\[\]\*\w\s]*\)(?=\s*{)/) {|p| p = smashSpaces(p) - proto << p unless existingProto[p] + proto << p+";\n" unless existingProto[p] } contents.each_line do |line| if line =~ /^\s*#include\s+[<"](.*)[">]\s*(#.*)?$/ addLibrary($1) end end + %r{(?(?:\s+|//.*$|/\*.*?\*/)*)(?.*)}m =~ contents + outFile.print preamble + outFile.puts '#include "Arduino.h"' + outFile.print proto.join('') + outFile.puts "#line #{1+preamble.count("\n")}" + outFile.print rest end outFile.close ARGV[arg] = outName