mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
lsp: Add compile an decompile commands
This commit is contained in:
parent
8c3c43a34a
commit
6f4806bfb3
5 changed files with 74 additions and 3 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue