code generator progress
This commit is contained in:
parent
1322c1dfac
commit
ad09177105
Binary file not shown.
|
@ -26,6 +26,7 @@ public class ReaderState {
|
|||
private static final String STRUCT_NO_PREFIX = "struct_no_prefix ";
|
||||
private static final String STRUCT = "struct ";
|
||||
private static final String DEFINE_CONSTRUCTOR = "define_constructor";
|
||||
public static final char MULT_TOKEN = '*';
|
||||
public Stack<ConfigStructure> stack = new Stack<>();
|
||||
public Map<String, Integer> tsCustomSize = new HashMap<>();
|
||||
public Map<String, String> tsCustomLine = new HashMap<>();
|
||||
|
@ -80,7 +81,7 @@ public class ReaderState {
|
|||
customSize = customSize.replaceAll("x", "*");
|
||||
line = VariableRegistry.INSTANCE.applyVariables(line);
|
||||
|
||||
int multPosition = customSize.indexOf('*');
|
||||
int multPosition = customSize.indexOf(MULT_TOKEN);
|
||||
if (multPosition != -1) {
|
||||
String firstPart = customSize.substring(0, multPosition);
|
||||
int first;
|
||||
|
|
|
@ -57,6 +57,13 @@ public class VariableRegistry {
|
|||
return;
|
||||
}
|
||||
value = applyVariables(value);
|
||||
int multPosition = value.indexOf(MULT_TOKEN);
|
||||
if (multPosition != -1) {
|
||||
Integer first = Integer.valueOf(value.substring(0, multPosition));
|
||||
Integer second = Integer.valueOf(value.substring(multPosition + 1));
|
||||
value = String.valueOf(first * second);
|
||||
}
|
||||
|
||||
SystemOut.println("Registering " + var + " as " + value);
|
||||
data.put(var, value);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ConfigFieldParserTest {
|
|||
|
||||
assertEquals("#define ERROR_BUFFER_COUNT 120\n" +
|
||||
"#define ERROR_BUFFER_SIZE 120\n" +
|
||||
"#define RESULT 120*120\n", VariableRegistry.INSTANCE.getDefinesSection());
|
||||
"#define RESULT 14400\n", VariableRegistry.INSTANCE.getDefinesSection());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue