Files
gt4carp/lepiter/98eic2j16rr2u9v6h3elxhsll.bak
2022-06-11 20:52:51 +02:00

224 lines
5.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"__schema" : "4.1",
"__type" : "page",
"children" : {
"__type" : "snippets",
"items" : [
{
"__type" : "textSnippet",
"children" : {
"__type" : "snippets",
"items" : [ ]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:26:00.598758+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:27:38.908748+02:00"
}
},
"uid" : {
"__type" : "uid",
"uidString" : "+EdxxTyZDQCZwZeADqn2mw=="
},
"paragraphStyle" : {
"__type" : "textStyle"
},
"string" : "Once we have an AST, we might want to add syntax highlighting. Its actually quite simple to add syntax highlighting for an existing parser; all we need to do is add a method to the class {{gtClass:GtSmaCCParserStyler}}."
},
{
"__type" : "textSnippet",
"children" : {
"__type" : "snippets",
"items" : [ ]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:27:43.823213+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:30:41.645617+02:00"
}
},
"uid" : {
"__type" : "uid",
"uidString" : "rt9venqdDQCJG731AZ6iBQ=="
},
"paragraphStyle" : {
"__type" : "textStyle"
},
"string" : "In the case of Carp, the code resides in {{gtMethod:GtSmaCCParserStyler class>>#carpStyler:}} with some utilities in {{gtClass:CarpStylerUtilities}}. The code is straight-forward: we simply add a rule for all the different types of node we generated in [[Building a parser from scratch]] that we want to highlight with the style information such as color and text adornment."
},
{
"__type" : "textSnippet",
"children" : {
"__type" : "snippets",
"items" : [ ]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:30:43.246304+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:31:44.742069+02:00"
}
},
"uid" : {
"__type" : "uid",
"uidString" : "whgkhXqdDQCJpS0fAZ6iBQ=="
},
"paragraphStyle" : {
"__type" : "textStyle"
},
"string" : "If you need inspiration for your styler, here is a list of all the methods defined in {{gtClass:GtSmaCCParserStyler}}:"
},
{
"__type" : "textSnippet",
"children" : {
"__type" : "snippets",
"items" : [ ]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:32:13.252466+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-11T20:50:28.716326+02:00"
}
},
"uid" : {
"__type" : "uid",
"uidString" : "USl+inqdDQCJqBvxAZ6iBQ=="
},
"paragraphStyle" : {
"__type" : "textStyle"
},
"string" : "{{gtExample:GtSmaCCParserStyler class >> #itself | noCode=true | previewExpanded=true | previewShow=#gtParsersFor:}}"
},
{
"__type" : "textSnippet",
"children" : {
"__type" : "snippets",
"items" : [ ]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:44:52.275311+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-06-10T16:47:24.613405+02:00"
}
},
"uid" : {
"__type" : "uid",
"uidString" : "+ybFtnqdDQCJv51jAZ6iBQ=="
},
"paragraphStyle" : {
"__type" : "textStyle"
},
"string" : "In Carp, I also went down the extra mile of coloring parentheses according to their nesting level. The code for this is inside the rule for lists, maps and arrays, and it uses {{gtClass:CarpStylerUtilities}} to color the parentheses and register an event for when the cursor enters or leaves the region to highlight it. Should you want more complex highlighting and change it based on cursor position and interactions, this might give you a taste of how to do it."
}
]
},
"createEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"createTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-04-17T17:09:46.810502+02:00"
}
},
"editEmail" : {
"__type" : "email",
"emailString" : "<unknown>"
},
"editTime" : {
"__type" : "time",
"time" : {
"__type" : "dateAndTime",
"dateAndTimeString" : "2022-04-17T17:09:46.810502+02:00"
}
},
"pageType" : {
"__type" : "namedPage",
"title" : "Styling your AST"
},
"uid" : {
"__type" : "uuid",
"uuid" : "098070c5-3c99-0d00-99c0-2cce0ea9f69b"
}
}