eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
663 stars 61 forks source link

Escape strings in generated types #1537

Closed msujew closed 2 weeks ago

msujew commented 3 weeks ago

Closes https://github.com/eclipse-langium/langium/issues/1536

Correctly escapes all quotes inside of string values in the generated ast.ts file.

Also removes a few quotes in case they weren't needed (like for type references inside the ast reflection). This should improve bundle size.

msujew commented 3 weeks ago

cc @AlexandreLachanceGit I've seen that you've been encountering this issue in this parser rule. Note that you can work around it by giving the rule a return type:

interface Syntax {
    syntax: string;
}

Syntax returns Syntax: 
    'syntax' '=' syntax=('"proto3"' | "'proto3'") ';';