Skip to content

Commit

Permalink
Add colors in cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
RashikaKarki committed May 28, 2021
1 parent a2469b1 commit 3c71e8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/Storm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from Storm.error import *
from Storm.lexer import *
from Storm.type import *
from Storm.token import *
from Storm.lexer import Lexer
1 change: 0 additions & 1 deletion src/Storm/lexer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Text
from Storm import token


Expand Down
10 changes: 10 additions & 0 deletions src/bgcolors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
7 changes: 4 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from Storm import Lexer
from bgcolors import Bcolors

def run(text):
lexer = Lexer(text)
tokens, error = lexer.make_tokens()
print(tokens)
if error:
print("ERROR")
print(error)
print(f"{Bcolors.FAIL}ERROR{Bcolors.ENDC}")
print(f"{Bcolors.FAIL}{error}{Bcolors.ENDC}")


while True:
text = input("storm > ")
text = input(f"{Bcolors.OKBLUE}strom > {Bcolors.ENDC} ")
run(text)

0 comments on commit 3c71e8b

Please sign in to comment.