r5931 - trunk/eda/boom

werner at docs.openmoko.org werner at docs.openmoko.org
Sat Apr 24 11:54:32 CEST 2010


Author: werner
Date: 2010-04-24 11:54:32 +0200 (Sat, 24 Apr 2010)
New Revision: 5931

Modified:
   trunk/eda/boom/parser.pl
Log:
KiCad BOMs (.lst) are localized. BOOM's BOM parser so far recognized only the
English version. The commit replaces the parser with a looser version that
looks only for the hash signs, ignoring any text following them.

- boom/parser.pl: added language-tolerant parser mode for KiCad BOMs (reported
  by Igor Almeida)



Modified: trunk/eda/boom/parser.pl
===================================================================
--- trunk/eda/boom/parser.pl	2010-04-23 22:01:56 UTC (rev 5930)
+++ trunk/eda/boom/parser.pl	2010-04-24 09:54:32 UTC (rev 5931)
@@ -347,23 +347,49 @@
 }
 
 
+sub babylonic
+{
+    if ($_[0] =~ /^#/) {
+	$hash++;
+	if ($hash == 2) {
+	    $mode = *skip;
+	    undef $raw;
+	}
+	return;
+    }
+    &bom($_[0]) if $hash == 1;
+}
+
+
 sub parse
 {
     $mode = *skip;
     while (<>) {
 	chop;
-	if (/^#Cmp.*order = Reference/) {
+
+# ----- KiCad BOM parsing. Alas, the BOM is localized, so there are almost no
+# reliable clues for the parser. Below would be good clues for the English
+# version:
+	if (0 && /^#Cmp.*order = Reference/) {
 	    $mode = *bom;
 	    next;
 	}
-	if (/^#Cmp.*order = Value/) {
+	if (0 && /^#Cmp.*order = Value/) {
 	    $mode = *skip;
 	    next;
 	}
-	if (/^eeschema \(/) {	# hack to allow loading in any order
+	if (0 && /^eeschema \(/) {	# hack to allow loading in any order
 	    $mode = *skip;
 	    next;
 	}
+# ----- now an attempt at a "generic" version:
+	if (/^eeschema \(/) {
+	    $mode = *babylonic;
+	    $hash = 0;
+	    $raw = 1;
+	    next;
+	}
+# -----
 	if (/^EESchema Schematic/) {
 	    $mode = *eeschema;
 	    $raw = 1;




More information about the commitlog mailing list