Positional matching
Patrick Kelly <[email protected]> Sun, 14 Jun 2015 17:35:47 -0400
| Newsgroups | gmane.comp.gnome.devtools |
|---|---|
| Message-ID | <[email protected]> |
--===============3903096824991372696==
Content-Type: multipart/alternative;
boundary="_f07e0f03-4b02-4c88-8a24-44f614345a1b_"
--_f07e0f03-4b02-4c88-8a24-44f614345a1b_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
So I have the following code sample:
function "mod"(Left : Float=3B Right : Float) return Float with Inline=
=2C Pre =3D> Right /=3D 0.0=3B
"mod" is obviously a string. Highlighting for this is easy.
Types (float here) I'll deal with later.
"function"=2C "return"=2C and "with" are keywords.
The "with Inline=2C Pre =3D> Right /=3D 0.0" part is an aspect declaration.=
This is also currently where I'm having problems.
If I completely ignore trying to highlight the aspects=2C highlighting the =
keyword "with" is easy. Of course=2C highlighting "Inline" and "Pre" as key=
words would be an easy=2C but flawed solution=2C as they would highlight an=
ywhere=2C even though they are valid identifiers elsewhere. As such=2C they=
should only be highlighted as aspects in this context.
I'm currently using the following definition in .lang:
<context id=3D"aspect-directive"> <start>with</start> <end>(i=
s|=3B)</end> <include> <context id=3D"aspect-keyword" style-ref=
=3D"keyword" extend-parent=3D"false"> <keyword>with</keyword> =
<keyword>is</keyword> </context> <context id=3D"aspect-n=
ame" style-ref=3D"aspect" extend-parent=3D"false"> <keyword>addres=
s</keyword> ... ... </context> </include> =
</context>
The ordering of the language context is:
<context ref=3D"aspect-directive"/> <context ref=3D"keyword"/>
This causes "Pre" and "Inline" to highlight properly=2C but removes the hig=
hlighting of "with".
Chaning the ordering to:
<context ref=3D"keyword"/> <context ref=3D"aspect-directive"/>
causes "with" to highlight properly=2C but removes the highlighting of "Pre=
" and "Inline".
How do I get this working properly? =
--_f07e0f03-4b02-4c88-8a24-44f614345a1b_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 12pt=3B
font-family:Calibri
}
--></style></head>
<body class=3D'hmmessage'><div dir=3D'ltr'>So I have the following code sam=
ple:<div><br></div><div> =3B  =3B function "mod"(Left : Float=3B Ri=
ght : Float) return Float with Inline=2C Pre =3D>=3B Right /=3D 0.0=3B</d=
iv><div><br></div><div>"mod" is obviously a string. Highlighting for this i=
s easy.</div><div><br></div><div>Types (float here) I'll deal with later.</=
div><div><br></div><div>"function"=2C "return"=2C and "with" are keywords.<=
/div><div><br></div><div>The "with Inline=2C Pre =3D>=3B Right /=3D 0.0" =
part is an aspect declaration. This is also currently where I'm having prob=
lems.</div><div><br></div><div>If I completely ignore trying to highlight t=
he aspects=2C highlighting the keyword "with" is easy. Of course=2C highlig=
hting "Inline" and "Pre" as keywords would be an easy=2C but flawed solutio=
n=2C as they would highlight anywhere=2C even though they are valid identif=
iers elsewhere. As such=2C they should only be highlighted as aspects in th=
is context.</div><div><br></div><div>I'm currently using the following defi=
nition in .lang:</div><div><br></div><div> =3B  =3B <=3Bcontext i=
d=3D"aspect-directive">=3B</div><div> =3B  =3B  =3B <=3Bsta=
rt>=3Bwith<=3B/start>=3B</div><div> =3B  =3B  =3B <=3Be=
nd>=3B(is|=3B)<=3B/end>=3B</div><div> =3B  =3B  =3B <=
=3Binclude>=3B</div><div> =3B  =3B  =3B  =3B <=3Bcontex=
t id=3D"aspect-keyword" style-ref=3D"keyword" extend-parent=3D"false">=3B=
</div><div> =3B  =3B  =3B  =3B  =3B <=3Bkeyword>=3B=
with<=3B/keyword>=3B</div><div> =3B  =3B  =3B  =3B &nbs=
p=3B <=3Bkeyword>=3Bis<=3B/keyword>=3B</div><div> =3B  =3B =
 =3B  =3B <=3B/context>=3B</div><div> =3B  =3B  =3B=
 =3B <=3Bcontext id=3D"aspect-name" style-ref=3D"aspect" extend-pare=
nt=3D"false">=3B</div><div> =3B  =3B  =3B  =3B  =3B &=
lt=3Bkeyword>=3Baddress<=3B/keyword>=3B</div><div> =3B  =3B &=
nbsp=3B  =3B  =3B ...</div><div> =3B  =3B  =3B  =3B=
 =3B ...</div><div> =3B  =3B  =3B  =3B <=3B/context&=
gt=3B</div><div> =3B  =3B  =3B <=3B/include>=3B</div><div>&=
nbsp=3B  =3B <=3B/context>=3B</div><div><br></div><div>The ordering=
of the language context is:</div><div><br></div><div> =3B  =3B <=
=3Bcontext ref=3D"aspect-directive"/>=3B</div><div> =3B  =3B <=
=3Bcontext ref=3D"keyword"/>=3B</div><div><br></div><div>This causes "Pre=
" and "Inline" to highlight properly=2C but removes the highlighting of "wi=
th".</div><div><br></div><div>Chaning the ordering to:</div><div><br></div>=
<div> =3B  =3B <=3Bcontext ref=3D"keyword"/>=3B</div><div> =
=3B  =3B <=3Bcontext ref=3D"aspect-directive"/>=3B</div><div><br></=
div><div>causes "with" to highlight properly=2C but removes the highlightin=
g of "Pre" and "Inline".</div><div><br></div><div>How do I get this working=
properly?</div> </div></body>
</html>=
--_f07e0f03-4b02-4c88-8a24-44f614345a1b_--
--===============3903096824991372696==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools
--===============3903096824991372696==--