I'm working on a syntax file for a language called SCL

I'm experiencing a problem where a valid piece of syntax (a variable 
declaration) sudden;y changes state (becomes an (invalid) procedure call) 
following the insertion elsewhere in the file of an indexed assignment.

The form of the declaration is as follows:-

STRING ( 80 )
        FRED    := "Hello World"

that is properly analysed as a string declaration containing a type, an 
advisory length, and an assignment; the signalment is correctly analysed as a 
variable name, an assignment operator and a string expression.

Further down the file I add a line like this:-

JIM( 0 ) := "Ohhh! You are awful!"

which is correctly analysed as an anonymous assignment, containing a procedure 
call, and assignment operator and an expression.The word STRING becomes marked 
as an error (language keywords can't be used as variable names)

and the string declaration changes form as follows:-

The declaration is still detected, but the type and advisory length become a 
procedure call.

The complete syntax file is too long to be included here, but can be found at 
https://www.github.com/AndyLong/vim-syntax-vme-scl.

Here is a simple test file that shows the problem, which shows that the problem 
exhibits itself even when the assignment that provokes the error is inside a 
comment.

proc test is ()
procbegin
  string ( 80 )
    message := ""

  superstring ( 1, 80 )
    messages  := message

@ messages( 0 ) := message
procend

A few notes on the structure of the file:
1. sclProcedureCall is declared earlier in the syntax file than 
sclStringDeclaration.
2. I use 'foldmethod=syntax' and use folding aggressively to detect bad syntax.
3. sclStringDeclaration is a region with 'start=/\ze\<string\>/ 
skip=/\(\<string\|)\},\)\_s*/ end=/,/ end=/$/'
4. The reason for the \ze in the 'start' pattern is to make the folds work for 
declarations and assignments.
5. An indexed assignment is modelled as a procedure call - it has the asme 
semantics as a procedure call returning a reference has.

Can anyone suggest what might be causing this problem? 

Regards, Andy
-- 
Andrew Long
andrew dot long at mac dot com





Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to