Нахуй sql

This commit is contained in:
2025-10-27 22:35:15 +05:00
parent cb031e0a9e
commit 88746f6d41
2 changed files with 16 additions and 311 deletions

View File

@@ -3,34 +3,19 @@ MPSTWM
Автор: Игорь Рагозин
Лицензия: MIT(подробнее в /LICENSE)
'''
from dataclasses import dataclass
'''
Своя реализация парсера конфига Hyprland.
Примерный алгоритм работы, и концепции на основе
идеи рассказал ИИ. Код полностью написан с помощью обычных рук
'''
@dataclass
class ConfigComment:
value: str
line: int
@dataclass
class AirLine:
line: int
@dataclass
class ConfigVariable:
name: str
value: str
line: int
def ParserKeyValue(line):
line = line.strip()
if '=' in line:
key,value=line.split('=', 1)
key = key.strip()
value = value.strip(df)
value = value.strip()
return key, value
def isBlock(line):
@@ -40,19 +25,24 @@ def isBlock(line):
with open("example_hyprland.conf", "r") as file:
sections=[]
sections={
'commentConfig': [],
'air': [],
'variableConfig': [],
}
file = file.readlines()
for index, line in enumerate(file):
no_tab = line.strip()
if line.strip().startswith('#'):
comment = lambda value,line: ConfigComment(value,line+1)
sections.append(comment(no_tab,index))
sections['commentConfig'].append({'rawvalue': no_tab, 'line': index})
elif not line.strip():
airline = lambda line: AirLine(line+1)
sections.append(airline(index))
sections['air'].append({'line': index})
elif line.strip().startswith('$'):
value_line = ParserKeyValue(no_tab)
key,value = value_line[0],value_line[1]
variable = lambda name,value,line: ConfigVariable(name,value,line+1)
sections.append(variable(key,value,index))
print(sections)
sections['variableConfig'].append({'key': key, 'value': value, 'rawvalue': line, 'line': index})
elif no_tab.strip().endswith(' {'):
isBlock = True
nameBlock = no_tab.split()[0]
islist.append(nameBlock)
print(islist)