Esempio n. 1
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data

        self.imports = set(
            ["java.io.BufferedReader", "java.io.InputStreamReader"])
        existing_names = [var.name for var in input_data.input
                          ] + [var_name(input_data.name)]
        self.iterator = IteratorName(existing_names)
        self.words = WordsName(existing_names)
Esempio n. 2
0
def gen_lua(input_data: Input, reprint: bool = False) -> str:
    """Generate a Lua code to parse input"""
    iterator = IteratorName([var.name for var in input_data.input] + [input_data.name])
    output = "\n".join(call(input_data, reprint)) + "\n\n"
    for line in read_vars(input_data, iterator):
        output += line + "\n"
    args = (var_name(i.name) for i in input_data.input)
    output += "\n{}({})\n".format(var_name(input_data.name), ", ".join(args))
    return output
Esempio n. 3
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data

        self.includes = set()  # type: Set[str]
        self.main = []  # type: List[str]
        self.iterator = IteratorName([var.name for var in input_data.input])
        self.local_integers = set()  # type: Set[str]
        self.local_char = False
        self.indent_lvl = 0
Esempio n. 4
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data

        self.includes = set()  # type: Set[str]
        self.main = []  # type: List[str]
        self.method = []  # type: List[str]
        self.iterator = IteratorName([var.name for var in input_data.input])
        self.indent_lvl = 0

        self.indentation = 4
Esempio n. 5
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data

        self.includes = set()  # type: Set[str]
        self.main = []  # type: List[str]
        self.method = []  # type: List[str]
        self.iterator = IteratorName([var.name for var in input_data.input])
        self.endlines = [
            (True, [], IntegerOrString.UNKNOWN)
        ]  # type: List[Tuple[bool, List[int], IntegerOrString]]

        self.indentation = 4
Esempio n. 6
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data

        existing_names = [var.name for var in input_data.input]
        self.iterator = IteratorName(existing_names)
        self.words = WordsName(existing_names, cs_mode=True)
Esempio n. 7
0
    def __init__(self, input_data: Input) -> None:
        self.input = input_data
        self.imports = set(["bufio", "os"])

        self.iterator = IteratorName([var.name for var in input_data.input])
Esempio n. 8
0
 def __init__(self, input_data: Input) -> None:
     self.input = input_data
     self.imports = {"std.stdio": {"stdin"}}
     self.iterator = IteratorName([var.name for var in input_data.input])
Esempio n. 9
0
 def __init__(self, input_data: Input):
     self.input = input_data
     self.iterator = IteratorName([var.name for var in input_data.input] +
                                  [input_data.name])
Esempio n. 10
0
 def __init__(self, input_data: Input) -> None:
     self.input = input_data
     existing_names = [var_name(var.name) for var in input_data.input
                       ] + [var_name(input_data.name)]
     self.iterator = IteratorName(existing_names)
     self.words = WordsName(existing_names)