VVT minimum RPM #4545

let's see who else is affected
This commit is contained in:
rusefillc 2022-10-07 11:59:10 -04:00
parent 4dbc7cb5bb
commit 9a7054008a
4 changed files with 32 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.rusefi;
import com.devexperts.logging.Logging;
import com.opensr5.ini.field.EnumIniField;
import com.rusefi.core.Pair;
import com.rusefi.output.ConfigStructure;
import com.rusefi.output.JavaFieldsConsumer;
@ -162,6 +163,7 @@ public class ConfigField {
}
String comment = matcher.group(10);
validateComment(comment);
String type = matcher.group(1);
int[] arraySizes;
String arraySizeAsText;
@ -195,6 +197,16 @@ public class ConfigField {
return field;
}
private static void validateComment(String comment) {
if (comment == null)
return;
comment = comment.trim();
if (comment.isEmpty())
return;
if (comment.charAt(0) == '"' && !EnumIniField.isQuoted(comment))
throw new MaybeSemicolorWasMissedException("This comment looks like semicolon was missed: " + comment);
}
public static boolean isPreprocessorDirective(String line) {
Matcher matcher = DIRECTIVE.matcher(line);
return matcher.matches();

View File

@ -0,0 +1,7 @@
package com.rusefi;
public class MaybeSemicolorWasMissedException extends IllegalArgumentException {
public MaybeSemicolorWasMissedException(String s) {
super(s);
}
}

View File

@ -1,5 +1,6 @@
package com.rusefi.test;
import com.rusefi.MaybeSemicolorWasMissedException;
import com.rusefi.ReaderState;
import com.rusefi.output.GetConfigValueConsumer;
import org.junit.Test;
@ -186,4 +187,16 @@ public class GetConfigValueConsumerTest {
"\treturn EFI_ERROR_CODE;\n" +
"}\n", getConfigValueConsumer.getHeaderAndGetter());
}
@Test(expected = MaybeSemicolorWasMissedException.class)
public void generateSuspiciousTsInfo() throws IOException {
String test = "struct total\n" +
"uint8_t hello;\"unit\", 1, 0, 0, 100, 0\n" +
"end_struct\n";
ReaderState state = new ReaderState();
GetConfigValueConsumer getConfigValueConsumer = new GetConfigValueConsumer(null);
state.readBufferedReader(test, getConfigValueConsumer);
}
}

Binary file not shown.