-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: moved theme setting to another folder
- Loading branch information
Showing
6 changed files
with
255 additions
and
145 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
''' | ||
This file contains compiler theme configurations and color schemes. | ||
Use the sample file to make more templates | ||
''' | ||
|
||
from .tokyo import tokyo | ||
|
||
themes = { | ||
'tokyo' : tokyo.config | ||
# Add more themes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
from enum import Enum | ||
|
||
class ThemeColors(): | ||
def __init__(self, colors: dict[str, str]): | ||
self.colors = colors | ||
self._assign_colors() | ||
|
||
def _assign_colors(self): | ||
for key, value in self.colors.items(): | ||
setattr(self, key, value) | ||
|
||
def __str__(self): | ||
return str(self.colors) | ||
|
||
MAIN = "MAIN" | ||
GLOBAL = "GLOBAL" | ||
KEYWORD = "KEYWORD" | ||
IDENTIFIER = "IDENTIFIER" | ||
CWASS = "CWASS" | ||
METHOD = "METHOD" | ||
CONTROL_STRUCTURE = "CONTROL_STRUCTURE" | ||
CONSTANT_TYPE = "CONSTANT_TYPE" | ||
TYPE = "TYPE" | ||
COMMENT = "COMMENT" | ||
GROUPING = "GROUPING" | ||
NUMBER = "NUMBER" | ||
BOOL = "BOOL" | ||
STRING = "STRING" | ||
NUWW = "NUWW" | ||
ARITHMETIC_OPERATOR = "ARITHMETIC_OPERATOR" | ||
LOGICAL_OPERATOR = "LOGICAL_OPERATOR" | ||
UNARY_OPERATOR = "UNARY_OPERATOR" | ||
OTHER_SYMBOL = "OTHER_SYMBOL" | ||
TERMINATOR = "TERMINATOR" | ||
DEFAULT = "DEFAULT" | ||
|
||
class ThemeConfig(): | ||
def __init__(self, theme_colors: ThemeColors): | ||
self.theme_colors = theme_colors | ||
|
||
@property | ||
def config(self) -> dict[str, ThemeColors]: | ||
return { | ||
# main | ||
'mainuwu' : self.theme_colors.MAIN, | ||
|
||
# globals and keywords | ||
'fwunc' : self.theme_colors.GLOBAL, | ||
'gwobaw' : self.theme_colors.GLOBAL, | ||
'cwass' : self.theme_colors.GLOBAL, | ||
'inpwt' : self.theme_colors.KEYWORD, | ||
'pwint' : self.theme_colors.KEYWORD, | ||
'wetuwn' : self.theme_colors.KEYWORD, | ||
|
||
# identifiers | ||
'IDENTIFIER' : self.theme_colors.IDENTIFIER, | ||
'CWASS' : self.theme_colors.CWASS, | ||
|
||
# types | ||
'chan' : self.theme_colors.TYPE, | ||
'kun' : self.theme_colors.TYPE, | ||
'sama' : self.theme_colors.TYPE, | ||
'senpai' : self.theme_colors.TYPE, | ||
'san' : self.theme_colors.TYPE, | ||
'dono' : self.theme_colors.CONSTANT_TYPE, | ||
|
||
# arith operators | ||
"=" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
"+" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
"-" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
"*" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
"/" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
"%" : self.theme_colors.ARITHMETIC_OPERATOR, | ||
|
||
# logical, unary opt | ||
">" : self.theme_colors.LOGICAL_OPERATOR, | ||
"<" : self.theme_colors.LOGICAL_OPERATOR, | ||
">=" : self.theme_colors.LOGICAL_OPERATOR, | ||
"<=" : self.theme_colors.LOGICAL_OPERATOR, | ||
"==" : self.theme_colors.LOGICAL_OPERATOR, | ||
"!=" : self.theme_colors.LOGICAL_OPERATOR, | ||
"&&" : self.theme_colors.LOGICAL_OPERATOR, | ||
"||" : self.theme_colors.LOGICAL_OPERATOR, | ||
"++" : self.theme_colors.UNARY_OPERATOR, | ||
"--" : self.theme_colors.UNARY_OPERATOR, | ||
|
||
# control structure | ||
'fow' : self.theme_colors.CONTROL_STRUCTURE, | ||
'whiwe' : self.theme_colors.CONTROL_STRUCTURE, | ||
'do whiwe' : self.theme_colors.CONTROL_STRUCTURE, | ||
'iwf' : self.theme_colors.CONTROL_STRUCTURE, | ||
'ewse' : self.theme_colors.CONTROL_STRUCTURE, | ||
'ewse iwf' : self.theme_colors.CONTROL_STRUCTURE, | ||
'bweak' : self.theme_colors.CONTROL_STRUCTURE, | ||
|
||
# grouping symbols | ||
"[[" : self.theme_colors.GROUPING, | ||
"]]" : self.theme_colors.GROUPING, | ||
"[" : self.theme_colors.GROUPING, | ||
"]" : self.theme_colors.GROUPING, | ||
"{" : self.theme_colors.GROUPING, | ||
"}" : self.theme_colors.GROUPING, | ||
"(" : self.theme_colors.GROUPING, | ||
")" : self.theme_colors.GROUPING, | ||
|
||
# literals | ||
'INT_LITERAL' : self.theme_colors.NUMBER, | ||
'FLOAT_LITERAL' : self.theme_colors.NUMBER, | ||
'STRING_LITERAL' : self.theme_colors.STRING, | ||
'STRING_PART_START' : self.theme_colors.STRING, | ||
'STRING_PART_END' : self.theme_colors.STRING, | ||
'fax' : self.theme_colors.BOOL, | ||
'cap' : self.theme_colors.BOOL, | ||
'nuww' : self.theme_colors.NUWW, | ||
|
||
# others | ||
"&" : self.theme_colors.OTHER_SYMBOL, | ||
"," : self.theme_colors.OTHER_SYMBOL, | ||
"." : self.theme_colors.OTHER_SYMBOL, | ||
|
||
# comments | ||
'COMMENT' : self.theme_colors.COMMENT, | ||
'MULTI LINE COMMENT' : self.theme_colors.COMMENT, | ||
|
||
# methods | ||
'METHOD' : self.theme_colors.METHOD, | ||
|
||
# terminator | ||
"~" : self.theme_colors.TERMINATOR, | ||
|
||
# default | ||
'default' : self.theme_colors.DEFAULT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from .config import * | ||
|
||
colors = { | ||
"MAIN": '', | ||
"GLOBAL": '', | ||
"KEYWORD": '', | ||
"IDENTIFIER": '', | ||
"CWASS": '', | ||
"METHOD": '', | ||
"CONTROL_STRUCTURE": '', | ||
"CONSTANT_TYPE": '', | ||
"TYPE": '', | ||
"COMMENT": '', | ||
"GROUPING": '', | ||
"NUMBER": '', | ||
"BOOL": '', | ||
"STRING": '', | ||
"NUWW": '', | ||
"ARITHMETIC_OPERATOR": '', | ||
"LOGICAL_OPERATOR": '', | ||
"UNARY_OPERATOR": '', | ||
"OTHER_SYMBOL": '', | ||
"TERMINATOR": '', | ||
"DEFAULT": '', | ||
} | ||
|
||
tc = ThemeColors(colors=colors) | ||
sample = ThemeConfig(theme_colors=tc) |
Oops, something went wrong.