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

1290Re: [jasspa] Indent question about modes

Expand Messages
  • Jon Green
    Dec 7, 2004
    • 0 Attachment
      jeremy@... wrote:
      > I have a syntax file I am creating a highlighting mode for and it has
      > things such as:
      >
      > clearing : Room
      > 'A simple room'
      > "This is one simple room"
      >
      > doEnter() {
      > say("Hello");
      > }
      > ;
      >
      > Where I am running into problems is the function doEnter() ... I have
      > { set to indent 4, ; to outdent 4, and } to outdent 4.
      >
      > The ; needs to outdent 4 because it ends a definition, such as
      > 'clearing' in this case. But it also ends portions of other items such
      > as commands 'say("Hello");' ...
      >
      > Can anyone offer a method to make this work correctly? So far for
      > indenting this is what I have:
      >
      > !if &sin "d" .fhook-tads.setup
      > ; define indentation scheme
      > 0 indent .hilight.tads 1 10
      >
      > indent .hilight.tads n ":" 4
      > indent .hilight.tads o ";" -4
      > indent .hilight.tads n "{" 4
      > indent .hilight.tads o "}" -4
      > indent .hilight.tads n "\\[" 4
      > indent .hilight.tads o "\\]" -4
      > indent .hilight.tads b "(" ")"
      > indent .hilight.tads e "\"" "\"" "\\"
      > indent .hilight.tads e "'" "'" "\\"
      > !endif
      >
      > Thanks!
      >
      > Jeremy
      >

      Suggest that the ';' rule is changed to:-

      indent .hilight.tads o "^\\s *;" -4

      That is the ';' is only used for indentation when
      it appears as the first non-whitespace character
      of the line.

      This fixes the code example that you sent, I'm not
      sure whether this witll break any other constructs.

      Jon.
    • Show all 4 messages in this topic