lsp: Add compile an decompile commands

This commit is contained in:
Sonny Piers 2023-03-19 22:14:42 +00:00 committed by James Westman
parent 8c3c43a34a
commit 6f4806bfb3
5 changed files with 74 additions and 3 deletions

View file

@ -22,7 +22,7 @@ from enum import Enum
import typing as T
from dataclasses import dataclass
from .xml_reader import Element, parse
from .xml_reader import Element, parse, parse_string
from .gir import *
from .utils import Colors
@ -211,6 +211,15 @@ def decompile(data: str) -> str:
return ctx.result
def decompile_string(data):
ctx = DecompileCtx()
xml = parse_string(data)
_decompile_element(ctx, None, xml)
return ctx.result
def canon(string: str) -> str:
if string == "class":
return "klass"