[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-devel
Subject: Re: [ jEdit-devel ] Help with Mode file for todotxt.
From: Eric Berry <elberry () gmail ! com>
Date: 2015-10-30 4:48:57
Message-ID: CAKMBPmJZJgCB4gMi0A18tR0VRgCKKcMn0_7mkwOH7-R=MEorGQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
No problem. I don't think it's possible given jEdit's current syntax
definition capabilities. It seems like we need a MATCH_DELEGATE or
something so that the match can be reprocessed like DELEGATE content can,
or a way to specify a MATCH_TYPE on an END tag of a SPAN_REGEXP, or TYPE on
the BEGIN or END tags of a SPAN_REGEXP.
I don't know if any of that is possible. I'll just highlight all dates for
now - it makes sense to me to make them stand out anyway.
If there's any other ideas, I'd be very happy to hear them. :)
Thanks!
On Thu, Oct 29, 2015 at 5:21 PM, Dale Anson <dale@daleanson.com> wrote:
> Ah, that explains the "AEIMQUY" that you had in your first message.
>
> I see what you mean, my test file didn't have that specific case.
>
>
> On Thu, Oct 29, 2015 at 4:45 PM, Eric Berry <elberry@gmail.com> wrote:
>
>> PS, this is what I have for the rest of the features:
>>
>> <?xml version="1.0"?>
>> <!DOCTYPE MODE SYSTEM "xmode.dtd">
>> <MODE>
>> <RULES>
>> <IMPORT DELEGATE="CONTEXT_AND_PROJECT"/>
>> <IMPORT DELEGATE="DATE" />
>> <IMPORT DELEGATE="PRIORITY"/>
>> </RULES>
>> <RULES SET="CONTEXT_AND_PROJECT">
>> <SEQ_REGEXP HASH_CHAR="+" TYPE="KEYWORD2"
>> AT_WORD_START="TRUE">\+\S+</SEQ_REGEXP>
>> <SEQ_REGEXP HASH_CHAR="@" TYPE="KEYWORD3"
>> AT_WORD_START="TRUE">@\S+</SEQ_REGEXP>
>> </RULES>
>> <RULES SET="PRIORITY" IGNORE_CASE="FALSE">
>> <!-- varying colors for priorities -->
>> <SEQ_REGEXP TYPE="LITERAL1"
>> AT_LINE_START="TRUE">\([AEIMQUY]\)\s</SEQ_REGEXP>
>> <SEQ_REGEXP TYPE="LITERAL2"
>> AT_LINE_START="TRUE">\([BFJNRVZ]\)\s</SEQ_REGEXP>
>> <SEQ_REGEXP TYPE="LITERAL3"
>> AT_LINE_START="TRUE">\([CGKOSW]\)\s</SEQ_REGEXP>
>> <SEQ_REGEXP TYPE="LITERAL4"
>> AT_LINE_START="TRUE">\([DHLPTX]\)\s</SEQ_REGEXP>
>> </RULES>
>> <RULES SET="DATE">
>> <SEQ_REGEXP TYPE="KEYWORD4"
>> AT_LINE_START="TRUE">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>> </RULES>
>> <RULES SET="DATE_FLOATING">
>> <SEQ_REGEXP TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>> </RULES>
>> </MODE>
>>
>> On Thu, Oct 29, 2015 at 3:43 PM, Eric Berry <elberry@gmail.com> wrote:
>>
>>> Wow! Nice Dale. Thanks for working on all the rules! :D
>>>
>>> It's really close to what I have for all the features. Your "priority
>>> and date" one works on (A), but not (B) where it seems to catch the date at
>>> the end of the line as well as at the beginning. The spec says it's only a
>>> "date created" if it immediately follows the priority.
>>>
>>> (A) 2011-03-02 Call Mom // works correctly
>>> (B) Call Mom 2011-03-02 // catches 2011-03-02 which is incorrect.
>>>
>>> On Thu, Oct 29, 2015 at 3:17 PM, Dale Anson <dale@daleanson.com> wrote:
>>>
>>>> This seems to work. I'm not real familiar with the 'todo' format, so
>>>> this might need some adjustment.
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE MODE SYSTEM "xmode.dtd"><!-- -->
>>>>
>>>>
>>>> <MODE>
>>>> <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE">
>>>>
>>>> <!-- priority and date -->
>>>> <SEQ_REGEXP TYPE="LITERAL1" AT_LINE_START="TRUE"
>>>> DELEGATE="DATE_FLOATING">[(][A-Z][)][ ]</SEQ_REGEXP>
>>>> <!-- priority -->
>>>> <SEQ_REGEXP AT_LINE_START="TRUE" TYPE="LITERAL1">[(][A-Z][)][
>>>> ]</SEQ_REGEXP>
>>>> <!-- priority date -->
>>>> <SEQ_REGEXP AT_LINE_START="TRUE"
>>>> TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>>>>
>>>> <!-- context -->
>>>> <MARK_FOLLOWING TYPE="KEYWORD3">@</MARK_FOLLOWING>
>>>>
>>>> <!-- project -->
>>>> <MARK_FOLLOWING TYPE="KEYWORD3">+</MARK_FOLLOWING>
>>>>
>>>> </RULES>
>>>> <RULES SET="DATE_FLOATING">
>>>>
>>>> <!-- priority date -->
>>>> <SEQ_REGEXP TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>>>>
>>>> <!-- priority -->
>>>> <SEQ_REGEXP AT_LINE_START="TRUE" TYPE="LITERAL1">[(][A-Z][)][
>>>> ]</SEQ_REGEXP>
>>>> <!-- priority date -->
>>>> <SEQ_REGEXP AT_LINE_START="TRUE"
>>>> TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>>>>
>>>> <!-- context -->
>>>> <MARK_FOLLOWING TYPE="KEYWORD3">@</MARK_FOLLOWING>
>>>>
>>>> <!-- project -->
>>>> <MARK_FOLLOWING TYPE="KEYWORD3">+</MARK_FOLLOWING>
>>>>
>>>> </RULES>
>>>>
>>>> </MODE>
>>>>
>>>>
>>>> On Thu, Oct 29, 2015 at 12:32 PM, Eric Berry <elberry@gmail.com> wrote:
>>>>
>>>>> I'm creating a mode file for todotxt (
>>>>> https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format).
>>>>> I've got every feature implemented except for the date-created feature.
>>>>>
>>>>> More specifically, when date-created and priority are combined the
>>>>> date must come after the priority.
>>>>>
>>>>> Ex.
>>>>> (A) 2011-03-02 Call Mom
>>>>> (B) Call Mom 2011-03-02
>>>>>
>>>>> In the example (A) and (B) are the priority, and (A) has a
>>>>> date-created while (B) does not.
>>>>>
>>>>> What I want to do is have the priority be one color LITERAL1, and the
>>>>> date-created be KEYWORD4.
>>>>>
>>>>> I can't seem to get 2 different TYPEs into a single or delegated rule.
>>>>>
>>>>> I've tried doing a SEQ_REGEX with a DELEGATE attribute:
>>>>> <SEQ_REGEXP TYPE="LITERAL1" AT_LINE_START="TRUE"
>>>>> DELEGATE="DATE_FLOATING">\([AEIMQUY]\)\s\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>>>>> <RULES SET="DATE_FLOATING">
>>>>> <SEQ_REGEXP TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP>
>>>>> </RULES>
>>>>>
>>>>> I've also tried a few incarnations of a EOL_SPAN_REGEXP, and
>>>>> SPAN_REGEXP. It doesn't look like it's possible because anything that
>>>>> matches the REGEXP doesn't get highlighted through the DELEGATE.
>>>>>
>>>>> I might just punt and highlight all date's, but I was hoping I could
>>>>> highlight date-created dates as specified in the docs specifically.
>>>>>
>>>>> Any help here would be greatly appreciated.
>>>>>
>>>>> Thanks,
>>>>> Eric B
>>>>> --
>>>>> Learn from the past. Live in the present. Work towards the future.
>>>>> Blog: http://eric-berry.blogspot.com
>>>>> jEdit <http://www.jedit.org> - Programmer's Text Editor
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> --
>>>>> -----------------------------------------------
>>>>> jEdit Developers' List
>>>>> jEdit-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/jedit-devel
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Learn from the past. Live in the present. Work towards the future.
>>> Blog: http://eric-berry.blogspot.com
>>> jEdit <http://www.jedit.org> - Programmer's Text Editor
>>>
>>
>>
>>
>> --
>> Learn from the past. Live in the present. Work towards the future.
>> Blog: http://eric-berry.blogspot.com
>> jEdit <http://www.jedit.org> - Programmer's Text Editor
>>
>
>
--
Learn from the past. Live in the present. Work towards the future.
Blog: http://eric-berry.blogspot.com
jEdit <http://www.jedit.org> - Programmer's Text Editor
[Attachment #5 (text/html)]
<div dir="ltr"><div><div><div>No problem. I don't think it's possible given \
jEdit's current syntax definition capabilities. It seems like we need a \
MATCH_DELEGATE or something so that the match can be reprocessed like DELEGATE \
content can, or a way to specify a MATCH_TYPE on an END tag of a SPAN_REGEXP, or TYPE \
on the BEGIN or END tags of a SPAN_REGEXP.<br><br></div>I don't know if any of \
that is possible. I'll just highlight all dates for now - it makes sense to me to \
make them stand out anyway.<br><br></div>If there's any other ideas, I'd be \
very happy to hear them. :)<br><br></div>Thanks!<br></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 29, 2015 at 5:21 PM, \
Dale Anson <span dir="ltr"><<a href="mailto:dale@daleanson.com" \
target="_blank">dale@daleanson.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Ah, that explains the "<span \
style="font-family:monospace,monospace;font-size:13px">AEIMQUY" that you had in \
your first message. </span><div><span \
style="font-family:monospace,monospace;font-size:13px"><br></span></div><div><font \
face="monospace, monospace">I see what you mean, my test file didn't have that \
specific case. </font></div><div \
style="font-family:monospace,monospace;font-size:13px"><div><br></div></div></div><div \
class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div \
class="gmail_quote">On Thu, Oct 29, 2015 at 4:45 PM, Eric Berry <span \
dir="ltr"><<a href="mailto:elberry@gmail.com" \
target="_blank">elberry@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">PS, this is what I have for the rest of the \
features:<br><br><span style="font-family:monospace,monospace"><?xml \
version="1.0"?><br><!DOCTYPE MODE SYSTEM \
"xmode.dtd"><br><MODE><br> <RULES><br> \
<IMPORT DELEGATE="CONTEXT_AND_PROJECT"/><br> <IMPORT \
DELEGATE="DATE" /><br> <IMPORT \
DELEGATE="PRIORITY"/><br> </RULES><br> <RULES \
SET="CONTEXT_AND_PROJECT"><br> <SEQ_REGEXP \
HASH_CHAR="+" TYPE="KEYWORD2" \
AT_WORD_START="TRUE">\+\S+</SEQ_REGEXP><br> \
<SEQ_REGEXP HASH_CHAR="@" TYPE="KEYWORD3" \
AT_WORD_START="TRUE">@\S+</SEQ_REGEXP><br> \
</RULES><br> <RULES SET="PRIORITY" \
IGNORE_CASE="FALSE"><br> <!-- varying colors for \
priorities --><br> <SEQ_REGEXP TYPE="LITERAL1" \
AT_LINE_START="TRUE">\([AEIMQUY]\)\s</SEQ_REGEXP><br> \
<SEQ_REGEXP TYPE="LITERAL2" \
AT_LINE_START="TRUE">\([BFJNRVZ]\)\s</SEQ_REGEXP><br> \
<SEQ_REGEXP TYPE="LITERAL3" \
AT_LINE_START="TRUE">\([CGKOSW]\)\s</SEQ_REGEXP><br> \
<SEQ_REGEXP TYPE="LITERAL4" \
AT_LINE_START="TRUE">\([DHLPTX]\)\s</SEQ_REGEXP><br> \
</RULES><br> <RULES SET="DATE"><br> \
<SEQ_REGEXP TYPE="KEYWORD4" \
AT_LINE_START="TRUE">\d{4}-\d{2}-\d{2}</SEQ_REGEXP><span><br> \
</RULES><br> <RULES SET="DATE_FLOATING"><br> \
<SEQ_REGEXP TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP><br> \
</RULES><br></span></MODE></span><br></div><div><div><div \
class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 29, 2015 at 3:43 PM, \
Eric Berry <span dir="ltr"><<a href="mailto:elberry@gmail.com" \
target="_blank">elberry@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div>Wow! Nice Dale. Thanks for working on all \
the rules! :D<br><br>It's really close to what I have for all the features. Your \
"priority and date" one works on (A), but not (B) where it seems to catch \
the date at the end of the line as well as at the beginning. The spec says it's \
only a "date created" if it immediately follows the priority.<br><br><span \
style="font-family:monospace,monospace">(A) 2011-03-02 Call Mom // works \
correctly<br>(B) Call Mom 2011-03-02 // catches 2011-03-02 which is \
incorrect.</span><br></div></div><div><div><div class="gmail_extra"><br><div \
class="gmail_quote">On Thu, Oct 29, 2015 at 3:17 PM, Dale Anson <span \
dir="ltr"><<a href="mailto:dale@daleanson.com" \
target="_blank">dale@daleanson.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">This seems to work. I'm not real familiar \
with the 'todo' format, so this might need some \
adjustment.<div><br></div><div><div><?xml version="1.0" \
encoding="UTF-8"?></div><div><!DOCTYPE MODE SYSTEM \
"xmode.dtd"><!-- \
--></div><div><br></div><div><br></div><div><MODE></div><div> <RULES \
IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE"></div><div> \
</div><div><span style="white-space:pre-wrap"> </span><!-- priority and date \
--></div><div> <SEQ_REGEXP TYPE="LITERAL1" \
AT_LINE_START="TRUE" DELEGATE="DATE_FLOATING">[(][A-Z][)][ \
]</SEQ_REGEXP></div><div><span \
style="white-space:pre-wrap"> </span></div><div><span \
style="white-space:pre-wrap"> </span><!-- priority --></div><div> \
<SEQ_REGEXP AT_LINE_START="TRUE" \
TYPE="LITERAL1">[(][A-Z][)][ ]</SEQ_REGEXP></div><div><span \
style="white-space:pre-wrap"> </span></div><div><span \
style="white-space:pre-wrap"> </span><!-- priority date --></div><div> \
<SEQ_REGEXP AT_LINE_START="TRUE" \
TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP></div><div><span \
style="white-space:pre-wrap"> </span> </div><div> <!-- context \
--></div><div> <MARK_FOLLOWING \
TYPE="KEYWORD3">@</MARK_FOLLOWING></div><div> \
</div><div> <!-- project --></div><div> \
<MARK_FOLLOWING TYPE="KEYWORD3">+</MARK_FOLLOWING></div><div><br></div><div> \
</RULES></div><div> <RULES SET="DATE_FLOATING"></div><div> \
</div><div> <!-- priority date --></div><span><div> \
<SEQ_REGEXP TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP></div><div> \
</div></span><div><span style="white-space:pre-wrap"> </span><!-- priority \
--></div><div> <SEQ_REGEXP AT_LINE_START="TRUE" \
TYPE="LITERAL1">[(][A-Z][)][ ]</SEQ_REGEXP></div><div><span \
style="white-space:pre-wrap"> </span></div><div><span \
style="white-space:pre-wrap"> </span><!-- priority date --></div><div> \
<SEQ_REGEXP AT_LINE_START="TRUE" \
TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP></div><div><span \
style="white-space:pre-wrap"> </span> </div><div> <!-- context \
--></div><div> <MARK_FOLLOWING \
TYPE="KEYWORD3">@</MARK_FOLLOWING></div><div> \
</div><div> <!-- project --></div><div> \
<MARK_FOLLOWING TYPE="KEYWORD3">+</MARK_FOLLOWING></div><div><br></div><div> \
</RULES></div><div><br></div><div></MODE></div></div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Oct 29, 2015 at \
12:32 PM, Eric Berry <span dir="ltr"><<a href="mailto:elberry@gmail.com" \
target="_blank">elberry@gmail.com</a>></span> wrote:<br></div></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div><div \
dir="ltr"><div><div><div><div><div><div>I'm creating a mode file for todotxt (<a \
href="https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format" \
target="_blank">https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format</a>). \
I've got every feature implemented except for the date-created \
feature.<br><br></div>More specifically, when date-created and priority are combined \
the date must come after the priority.<br><br></div>Ex.<br><span \
style="font-family:monospace,monospace">(A) 2011-03-02 Call Mom<br>(B) Call Mom \
2011-03-02</span><br><br></div>In the example (A) and (B) are the priority, and (A) \
has a date-created while (B) does not.<br><br></div>What I want to do is have the \
priority be one color LITERAL1, and the date-created be KEYWORD4.<br><br></div>I \
can't seem to get 2 different TYPEs into a single or delegated \
rule.<br><br></div>I've tried doing a SEQ_REGEX with a DELEGATE \
attribute:<br><span style="font-family:monospace,monospace"><SEQ_REGEXP \
TYPE="LITERAL1" AT_LINE_START="TRUE" \
DELEGATE="DATE_FLOATING">\([AEIMQUY]\)\s\d{4}-\d{2}-\d{2}</SEQ_REGEXP></span><br \
clear="all"><div><div><div><div><div><div><div><div><div><div><span \
style="font-family:monospace,monospace"><RULES \
SET="DATE_FLOATING"><br> <SEQ_REGEXP \
TYPE="KEYWORD4">\d{4}-\d{2}-\d{2}</SEQ_REGEXP><br></RULES></span><br><br></div><div>I've \
also tried a few incarnations of a EOL_SPAN_REGEXP, and SPAN_REGEXP. It doesn't \
look like it's possible because anything that matches the REGEXP doesn't get \
highlighted through the DELEGATE.<br><br></div><div>I might just punt and highlight \
all date's, but I was hoping I could highlight date-created dates as specified in \
the docs specifically.<br><br>Any help here would be greatly \
appreciated.<br><br></div><div>Thanks,<br></div><div>Eric B<span><font \
color="#888888"><br></font></span></div><span><font color="#888888"><div>-- \
<br><div><div dir="ltr">Learn from the past. Live in the present. Work towards the \
future.<br>Blog: <a href="http://eric-berry.blogspot.com/" \
target="_blank">http://eric-berry.blogspot.com</a><br>jEdit <<a \
href="http://www.jedit.org/" target="_blank">http://www.jedit.org</a>> - \
Programmer's Text Editor<br></div></div> \
</div></font></span></div></div></div></div></div></div></div></div></div></div> \
<br></div></div>------------------------------------------------------------------------------<span><font \
color="#888888"><br> <br>--<br>
-----------------------------------------------<br>
jEdit Developers' List<br>
<a href="mailto:jEdit-devel@lists.sourceforge.net" \
target="_blank">jEdit-devel@lists.sourceforge.net</a><br> <a \
href="https://lists.sourceforge.net/lists/listinfo/jedit-devel" rel="noreferrer" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/jedit-devel</a><br> \
<br></font></span></blockquote></div><br></div> </blockquote></div><br><br \
clear="all"><br>-- <br><div><div dir="ltr">Learn from the past. Live in the present. \
Work towards the future.<br>Blog: <a href="http://eric-berry.blogspot.com/" \
target="_blank">http://eric-berry.blogspot.com</a><br>jEdit <<a \
href="http://www.jedit.org/" target="_blank">http://www.jedit.org</a>> - \
Programmer's Text Editor<br></div></div> </div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div><div \
dir="ltr">Learn from the past. Live in the present. Work towards the future.<br>Blog: \
<a href="http://eric-berry.blogspot.com/" \
target="_blank">http://eric-berry.blogspot.com</a><br>jEdit <<a \
href="http://www.jedit.org/" target="_blank">http://www.jedit.org</a>> - \
Programmer's Text Editor<br></div></div> </div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div \
class="gmail_signature"><div dir="ltr">Learn from the past. Live in the present. Work \
towards the future.<br>Blog: <a href="http://eric-berry.blogspot.com/" \
target="_blank">http://eric-berry.blogspot.com</a><br>jEdit <<a \
href="http://www.jedit.org/" target="_blank">http://www.jedit.org</a>> - \
Programmer's Text Editor<br></div></div> </div>
------------------------------------------------------------------------------
--
-----------------------------------------------
jEdit Developers' List
jEdit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic