Loading ...
Sorry, an error occurred while loading the content.

Re: [jasspa] Fancy Comment Mode (highlighter)

Expand Messages
  • Jon Green
    ... This will not work. If you think about what is happening you are not actually asking for a line indent, you are actually asking for a sub-indent from a
    Message 1 of 7 , Jan 18, 2004
    • 0 Attachment
      Jeremy Cowgar wrote:
      > On Sat, 2004-01-17 at 19:19, Jon Green wrote:
      >
      >>Jeremy Cowgar wrote:
      >>
      >>>Has anyone developed, or can give me a few pointers on doing so, a mode
      >>>to highlight special tags inside of special comments? For instance:
      >>>
      >>>/***
      >>> * @param string name - name of person to say hello to
      >>> * @returns bool - true if we said hi, false if we did not like the name
      >>> */
      >>>
      >>>It would be nice to have @param, @returns highlighted. I also use
      >>>RoboDoc which comments look like:
      >>>
      >>>/****f* module/function_name
      >>> * DESCRIPTION
      >>> * This is a cool function, it does a lot of neat things, none
      >>> * of which I can think of right now, sorry.
      >>> *
      >>> * AUTHOR
      >>> * Jeremy Cowgar
      >>> *
      >>> * CREATE DATE
      >>> * Jan 16, 2003
      >>> *****/
      >>>
      >>>It would be very nice to have DESCRIPTION, AUTHOR, CREATE DATE appear in
      >>>a different color as well.
      >>
      >>Hi Jeremy,
      >>
      >>I have set up the basic entry point from the 'C' hilighting
      >>as requested. I have placed this on your Wiki so if you extend
      >>it I can get it back with many more features !
      >>
      >>http://microemacs.cowgar.com/wakka.php?wakka=CdoxygenHilighting&v=l5m
      >>
      >>I have reproduced the template below. It is a simple
      >>scheme and is achived with an update to your myc.emf
      >>as shown below.
      >>
      >>I'll let you sort out RoboDoc, same principles apply.
      >>
      >>Regards
      >>Jon.
      >>
      >>--
      >>
      >>; Doxygen hilighting extensions
      >>!if &and &sin "h" .fhook-c.setup &band .hilight.flags 0x02
      >> ; Create a new doxygen hilighting scheme
      >> !if ¬ &exi .hilight.cdoxygen
      >> set-variable .hilight.cdoxygen &pinc .hilight.next 1
      >> !endif
      >> ; Add a hook into the normal 'C' hilighing. We jump into
      >> ; cdoxygen when we see an opening "/**" or "/*!".
      >> hilight .hilight.c 0x80 "/\\*\\*" .hilight.cdoxygen .scheme.comment
      >> hilight .hilight.c 0x80 "/\\*!" .hilight.cdoxygen .scheme.comment
      >> ; Doxygen hilighting space.
      >> 0 hilight .hilight.cdoxygen 2 50 .scheme.comment
      >> hilight .hilight.cdoxygen 1 "[\\\\@]}" .scheme.keyword
      >> hilight .hilight.cdoxygen 1 "[\\\\@]{" .scheme.keyword
      >> hilight .hilight.cdoxygen 1 "[\\\\@]a[ \t]+\\w+" .scheme.keyword
      >> hilight .hilight.cdoxygen 4 "[\\\\@]" "\\}\\W" "" .scheme.keyword
      >> ; We must return to C when we see the close of comment "*/"
      >> hilight .hilight.cdoxygen 0x80 "\\*/" .hilight.c .scheme.comment
      >>!endif
      >>
      >>
      >>__________________________________________________________________________
      >>
      >>This is an unmoderated list. JASSPA is not responsible for the content of
      >>any material posted to this list.
      >>
      >>To unsubscribe, send a mail message to
      >>
      >> mailto:jasspa-unsubscribe@yahoogroups.com
      >>
      >>or visit http://groups.yahoo.com/group/jasspa and
      >>modify your account settings manually.
      >>
      >>
      >>
      >>
      >>Yahoo! Groups Links
      >>
      >>To visit your group on the web, go to:
      >> http://groups.yahoo.com/group/jasspa/
      >>
      >>To unsubscribe from this group, send an email to:
      >> jasspa-unsubscribe@yahoogroups.com
      >>
      >>Your use of Yahoo! Groups is subject to:
      >> http://docs.yahoo.com/info/terms/
      >
      >
      > Thank you! Here is what I came up with,
      >
      > http://microemacs.cowgar.com/wakka.php?wakka=CrobodocHighlighting
      >
      > Now, I tried to make automatic indentation work, but I havn't got that
      > working yet. Maybe I'll work on it another day, it's late here now.
      >
      > But, what I have thus far in the indentation code is:
      >
      > !if &sin "d" .fhook-c.setup
      > ; define indentation scheme
      > 0 indent .hilight.crobodoc 1 10
      >
      > indent .hilight.crobodoc N "[ \t][A-Z ]" 2
      > !endif
      >
      > I was hoping to cause an indentation of 2 spaces to take place after any
      > * [A-Z]+ ... for instance:
      >

      This will not work. If you think about what is happening
      you are not actually asking for a line indent, you are actually
      asking for a 'sub-indent' from a base character which is '*'.
      (or more generally a base character of fhook-XXX.comment
      <mid-box-left>).

      If you force the line indentation to 2 then you will
      effectivelly force the * to be indented 2 from the
      left hand side of the page which is not what you want.

      The best way of dealing with this is to write a
      restyler i.e. "robodoc-restyle" which would replace
      (or extend) the comment-restyle for 'C'. If it follows
      the comment restyle in comment.emf and uses the
      fhook-XXX.comment variable then the restyling will
      work with any language. If you manage to do this then
      you have the basis of a generic robodoc toolset
      with hilighting that can be used with any
      template.

      So if you want to push this further then I suggest
      that you first get the basic tools in place for
      'C' of whatever your most used language is. Once
      these are all sorted then look at how they may be
      made generic and used with any language template
      as this is more difficult.

      Regards
      Jon.

      > /****f* module/function
      > * NAME
      > * this should be auto indented.
      > * and remain that way until either a blank line or
      > * another section starts, for instance:
      > *
      > * AUTHOR
      > * the blank line should have taken the indent out, or the
      > * presence of another comment attribute.
      > */
      >
      > anyway, the scheme I put up is working beautifully for RoboDoc comments.
      > I still need to do some more work such as the indenting, and also maybe
      > figuring out a generic way to include this code, because RoboDoc works
      > in any language. It would be a bummer to have to create something like
      > this for each language you work in, although I guess entirly possible.
      >
      > Also, I think I will try to highligh the standard robodoc headers in one
      > color, and then user defined ones in another.
      >
      > ----
      > jeremy <jc@...>
      >
      > May the Source be with you!
      >
      > __________________________________________________________________________
      >
      > This is an unmoderated list. JASSPA is not responsible for the content of
      > any material posted to this list.
      >
      > To unsubscribe, send a mail message to
      >
      > mailto:jasspa-unsubscribe@yahoogroups.com
      >
      > or visit http://groups.yahoo.com/group/jasspa and
      > modify your account settings manually.
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      > To visit your group on the web, go to:
      > http://groups.yahoo.com/group/jasspa/
      >
      > To unsubscribe from this group, send an email to:
      > jasspa-unsubscribe@yahoogroups.com
      >
      > Your use of Yahoo! Groups is subject to:
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.