[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] GroffHub
From: |
John Gardner |
Subject: |
Re: [Groff] GroffHub |
Date: |
Sat, 23 Jul 2016 17:25:54 +1000 |
Alright, some updates:
1. .ig requests now blank out their contents
<https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FAlhadis%2Flanguage-roff%2Fblob%2Fstatic%2Froff.json&grammar_text=&code_source=from-text&code_url=&code=.TH+COLOURED%0D%0A.ig%0D%0AIGNORED%0D%0A.TH+IGNORED%0D%0AIGNORED%0D%0A..%0D%0A%0D%0A.SH+SECTION%0D%0A%0D%0A.ig+END%0D%0A.TH+IGNORED%0D%0A..%0D%0A.TH+STILL+IGNORED%0D%0A.END>.
Ralph informed me that the request *does* modify auto-incrementing
registers, so I left those highlighted
<https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FAlhadis%2Flanguage-roff%2Fblob%2Fstatic%2Froff.json&grammar_text=&code_source=from-text&code_url=&code=.TH+COLOURED%0D%0A.ig%0D%0AIGNORED%0D%0ANOT+IGNORED%3A+%5Cn%2BX%0D%0AIGNORED%0D%0A..%0D%0A>.
Which
brings me to the next fix:
2. \n+X and its various forms are now highlighted correctly. I actually
wasn't aware of auto-incrementing registers, so I never wrote code to
accommodate that syntax. I'm an idiot.
3. Lastly, if anybody read through my sleep-deprived babble long enough
to hit the part about newlines and regex engines, you can discard my
rambling. Turns out the expressions are fine! You can see Ralph's
test highlighting
fine if it's loaded from a URL
<https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FAlhadis%2Flanguage-roff%2Fblob%2Fstatic%2Froff.json&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fgithub.com%2FAlhadis%2FBreakshow%2Fblob%2Fmaster%2Froff.1&code=>
.
This is a bug with GitHub's Lightshow, which I reported
<https://github.com/github/linguist/issues/3130> with something sitting
halfway between relief and irritation. I always knew it had buggy handling
of newlines, which I attributed to a different regex engine, but yeah, uh,
screw that. I said nothing.
On 23 July 2016 at 00:59, John Gardner <address@hidden> wrote:
> *CSTR 54 has a list of the original ones. :-)*
>
>
> Haha, don't worry, I was actually going through it page-by-page when I
> wrote this. =) I simply meant that I forgot about how that particular macro
> should affect highlighting.
>
> *After a .ft with no arguments, it seems.*
>
>
> Okay, you've just pointed out a very important oversight with how the
> site's parsing engine handles certain lookaheads. Thank you.
>
> GitHub's highlighting is driven by a different regular expression engine
> to the one Atom uses, so there're some discrepancies with how newlines are
> handled. I'll double-check each expression using (?=\n) and make sure
> it's using (?=\n|$) to cater for the differences.
>
> On 22 July 2016 at 23:47, Ralph Corderoy <address@hidden> wrote:
>
>> Hi John,
>>
>> > > That's why .ig doesn't cause subsequent lines to be ignored.
>> >
>> > Uh, actually, I completely forgot about that macro...
>>
>> CSTR 54 has a list of the original ones. :-)
>>
>> > That actually *can*
>> > be handled in a line-based fashion, because TextMate operates by opening
>> > "scopes" in response to patterns. Thanks for picking up on that!
>>
>> It's like .de rather than just ignoring its content, e.g.
>>
>> $ nroff | grep .
>> .nr x 1 10
>> \n+x
>> .ig gy
>> \n+x
>> .gy
>> \n+x
>> ^D
>> 11 31
>> $
>>
>> > > And why \\fB inside a .de is treated as \fB.
>> >
>> > That was actually a conscious exception on my part. Many roff macros
>> need
>> > heavy escaping, so I made all `\` characters match as one character.
>>
>> Ah, OK. I think one common error is forgetting to have sufficient \ in
>> a macro definition. (What do others think?) Having \fB and \\fB appear
>> different inside a .de scope would help show that. But I also see that
>> having the fB be recognised is useful too.
>>
>> > > Why is .PS orange versus .PE's purple?
>> >
>> > Hrm, could you show me where you're seeing that, please? =)
>>
>> After a .ft with no arguments, it seems.
>>
>>
>> https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FAlhadis%2Flanguage-roff%2Fblob%2Fstatic%2Froff.json&grammar_text=&code_source=from-text&code_url=https%3A%2F%2Fgithub.com%2Frust-lang%2Frust%2Fblob%2Fmaster%2Fman%2Frustdoc.1&code=.de+MO+ed%0D%0A%5C%5CfBerror%5CfP+%5C%5CfIok%5C%5CfP%0D%0A.ed%0D%0A.ig+gy%0D%0A.nothing+special%2C+but+%5Cn%2Br%0D%0A.gy%0D%0A.ft+B%0D%0A.ft%0D%0A.PS%0D%0Abox+box+box%0D%0A.PE
>>
>> Cheers, Ralph.
>>
>
>
- [Groff] GroffHub, John Gardner, 2016/07/21
- Re: [Groff] GroffHub, Werner LEMBERG, 2016/07/21
- Re: [Groff] GroffHub, John Gardner, 2016/07/21
- Re: [Groff] GroffHub, Werner LEMBERG, 2016/07/21
- Re: [Groff] GroffHub, Ralph Corderoy, 2016/07/22
- Re: [Groff] GroffHub, John Gardner, 2016/07/22
- Re: [Groff] GroffHub, Ralph Corderoy, 2016/07/22
- Re: [Groff] GroffHub, John Gardner, 2016/07/22
- Re: [Groff] GroffHub,
John Gardner <=