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

More on WORD#[+args] and syntax file

Expand Messages
  • tonibin
    Hi all, I recently dropped a post titled WORD # and syntax files , for help about highlighting a WORD followed by some symbol. The help I received, here and
    Message 1 of 1 , Jan 30, 2010
    • 0 Attachment
      Hi all,

      I recently dropped a post titled "WORD # and syntax files", for help
      about highlighting a WORD followed by some symbol.
      The help I received, here and by direct mail, helped me in
      understanding why I couldn't achieve the desired results, because the
      formulation for selecting WORD# had been preceded by a similar request
      through "syn keyword", and this covered the "syn match" I was
      operating on WORD.

      Just to be clear, this syntax file tries to emulate the DEC-10 BASIC
      compiler syntax (1974). Now, what I did resolve (with your active
      help) was for commands that accept a channel identifier, followed by
      anything else; e.g.:

      WRITE #1, A$
      PRINT :3, A,B,C
      INPUT 2, N$
      READ :5, A$

      the # symbol (that is not mandatory) means "sequential file", and
      the : symbol (which must be written) is for random access files.

      Now, in the DEC-10 BASIC, there are commands that don't accept
      arguments after a channel identifier, but accept channel identifiers
      as arguments:

      RESTORE 2, #4, :5
      RESTORE #2; 4, :5
      RESTORE :3; :4, 3

      The separator is a comma or a semicolon, the # (occasionally missing)
      is for sequential, : is for random.

      My purpose is to highlight the "RESTORE + channel" plus any other
      channel arguments left, but leaving the separators (commas and
      semicolons) not highlighted.

      I tried, for RESTORE, with the following line:
      syn match File "RESTORE\s*[#:]\s*\d\+[\s*[,;]\+\s*[#:]*\s*\d\+\s*]*"

      that tries to grab RESTORE plus the first argument and then all other
      arguments in turn (if any). But this doesn't work as expected, and
      above all, with this model I get commas and semicolons highlighted.

      Another model was to grab all arguments by their own with

      syn match File "[#:]\d\+"

      and RESTORE by its own, but this doesn't solve the fact that RESTORE 3
      (perfectly legal, in BASIC) has a number as argument, that is not
      highlighed (it should be written #3 for this). If I write

      syn match File "[#:]*\d\+"

      I of course get all numbers highlighted as well!

      Any help? Any ideas?

      Please, answer to tbin at libero dot it, if you want it, or directly
      to this thread.

      Thanks in advance, mates!

      -- Antonio

      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.