Complete parsing of .ino files
This commit is contained in:
parent
7efb7235bd
commit
2bbb509e18
|
@ -56,13 +56,19 @@ def parseInoFiles
|
||||||
proto = []
|
proto = []
|
||||||
prototypes.scan(/[\w\[\]\*]+\s+[&\[\]\*\w\s]+\([&,\[\]\*\w\s]*\)(?=\s*{)/) {|p|
|
prototypes.scan(/[\w\[\]\*]+\s+[&\[\]\*\w\s]+\([&,\[\]\*\w\s]*\)(?=\s*{)/) {|p|
|
||||||
p = smashSpaces(p)
|
p = smashSpaces(p)
|
||||||
proto << p unless existingProto[p]
|
proto << p+";\n" unless existingProto[p]
|
||||||
}
|
}
|
||||||
contents.each_line do |line|
|
contents.each_line do |line|
|
||||||
if line =~ /^\s*#include\s+[<"](.*)[">]\s*(#.*)?$/
|
if line =~ /^\s*#include\s+[<"](.*)[">]\s*(#.*)?$/
|
||||||
addLibrary($1)
|
addLibrary($1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
%r{(?<preamble>(?:\s+|//.*$|/\*.*?\*/)*)(?<rest>.*)}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
|
end
|
||||||
outFile.close
|
outFile.close
|
||||||
ARGV[arg] = outName
|
ARGV[arg] = outName
|
||||||
|
|
Loading…
Reference in New Issue
Block a user