Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions hohoho/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import argparse
from .hohoho import hohoho_to_whitespace
from .translator import whitespace_to_hohoho
from .hohoho import boobooboo_to_whitespace
from .translator import whitespace_to_boobooboo

parser = argparse.ArgumentParser(description='HoHoHo, the FESTIVE esolang! (powered by whitespace)', prog='hohoho')
parser = argparse.ArgumentParser(description='BooBooBoo, the FESTIVE esolang! (powered by whitespace)', prog='hohoho')
parser.add_argument(
'file',
metavar='input_file',
type=str,
help='Input file. Should be a .ho file unless you\'re translating from whitespace to hohoho',
help='Input file. Should be a .ho file unless you\'re translating from whitespace to boobooboo',
)
parser.add_argument(
'--from-ws',
'-t',
action='store_const',
const=True,
default=False,
help='Translate an input whitespace file into a hohoho file.',
help='Translate an input whitespace file into a boobooboo file.',
)

def main():
Expand All @@ -28,7 +28,7 @@ def main():
out_name = input_file.split('.')[0] + '.ho'
whitespace_to_hohoho(input_file, out_name)
Comment on lines 28 to 29
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change the file extension to something spooky!

else:
hohoho_to_whitespace(input_file)
boobooboo_to_whitespace(input_file)

if __name__ == '__main__':
main()
6 changes: 3 additions & 3 deletions hohoho/hohoho.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import os
from whitespace.cli import main

def hohoho_to_whitespace(file_name):
def boobooboo_to_whitespace(file_name):
with open(file_name) as input_file:
lines = input_file.readlines()

# Converts 'hohoho' to \t
# Converts ' ' to ''
# Converts 'snow' to ' '
for i in range(len(lines)):
lines[i] = lines[i].replace('hohoho', '\t')
lines[i] = lines[i].replace('boobooboo', '\t')
lines[i] = lines[i].replace(' ', '')
lines[i] = lines[i].replace('snow', ' ')
lines[i] = lines[i].replace('spoopy', ' ')
Comment on lines -12 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to make sure the tokens ("boobooboo" and "spoopy") are the same in each file!


# Write the transpiled lines to a temp file and interpret that using the whitespace interpreter
with open('output.ws', 'w') as f:
Expand Down
10 changes: 5 additions & 5 deletions hohoho/translator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
def whitespace_to_hohoho(input_file_name,output_file_name):
def whitespace_to_boobooboo(input_file_name,output_file_name):
with open(input_file_name) as input_file:
lines = input_file.readlines()

# Converts 'hohoho' to \t
# Converts 'boobooboo' to \t
# Converts ' ' to ''
# Converts 'ho' to ' '
# Converts 'boo' to ' '
for i in range(len(lines)):
lines[i] = lines[i].replace(' ', 'snow ')
lines[i] = lines[i].replace('\t', 'hohoho ')
lines[i] = lines[i].replace(' ', 'spoopy ')
lines[i] = lines[i].replace('\t', 'boobooboo ')


# Write the transpiled lines to a temp file and interpret that using the whitespace interpreter
Expand Down