Added syntax colorization
This commit is contained in:
@@ -5,6 +5,9 @@ Provides the Lark grammar and derived completions for the
|
||||
DataGrid Formatting DSL.
|
||||
"""
|
||||
|
||||
from functools import cached_property
|
||||
from typing import Dict, Any
|
||||
|
||||
from myfasthtml.core.dsl.base import DSLDefinition
|
||||
from myfasthtml.core.formatting.dsl.grammar import GRAMMAR
|
||||
|
||||
@@ -15,9 +18,20 @@ class FormattingDSL(DSLDefinition):
|
||||
|
||||
Uses the existing Lark grammar from grammar.py.
|
||||
"""
|
||||
|
||||
|
||||
name: str = "Formatting DSL"
|
||||
|
||||
|
||||
def get_grammar(self) -> str:
|
||||
"""Return the Lark grammar for formatting DSL."""
|
||||
return GRAMMAR
|
||||
|
||||
@cached_property
|
||||
def simple_mode_config(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Return hand-tuned Simple Mode configuration for optimal highlighting.
|
||||
|
||||
Overrides the base class to use a specialized configuration
|
||||
rather than auto-generated one.
|
||||
"""
|
||||
from myfasthtml.core.dsl.lark_to_simple_mode import generate_formatting_dsl_mode
|
||||
return generate_formatting_dsl_mode()
|
||||
|
||||
Reference in New Issue
Block a user