d
This commit is contained in:
@@ -4,12 +4,15 @@ def includes():
|
||||
return """#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "cli.h"
|
||||
#include "cli_Context.h"
|
||||
#include "memory.h"
|
||||
#include "memory_Context.h"
|
||||
#include "shell.h"
|
||||
"""
|
||||
|
||||
def replaceAnd(s):
|
||||
return s.replace("and", "&&")
|
||||
return s.replace(" and", " &&")
|
||||
|
||||
def replaceAppend(s):
|
||||
return s.replace(".append(", ".push_back(")
|
||||
@@ -30,6 +33,9 @@ def replaceLen(s):
|
||||
after = s[posEnd + len(")"):]
|
||||
return f"{before}{name}.size(){after}"
|
||||
|
||||
def replaceOr(s):
|
||||
return s.replace(" or", " ||")
|
||||
|
||||
def replaceTrue(s):
|
||||
return s.replace("True", "true")
|
||||
|
||||
@@ -170,6 +176,7 @@ class CPP:
|
||||
for i in range(0, len(self.fn.statements)):
|
||||
s = translateStatement(self.fn.statements[i], self)
|
||||
s = replaceAnd(s)
|
||||
s = replaceOr(s)
|
||||
s = replaceAppend(s)
|
||||
# Replace len twice to account for double invocation.
|
||||
s = replaceLen(s)
|
||||
|
||||
@@ -21,5 +21,5 @@ for arg in sys.argv:
|
||||
OPT_INCLUDES = arg[len(OPT_PREFIX_INCLUDES):]
|
||||
|
||||
# Translate file.
|
||||
out = process(FILE_IN, OPT_HEADER, OPT_INCLUDES)
|
||||
out = process(FILE_IN)#, OPT_HEADER, OPT_INCLUDES)
|
||||
print(out)
|
||||
|
||||
Reference in New Issue
Block a user