I am using the syntax editor to create an editor for a programming language that allows subroutines that do not necessarily have an end statement. For example:
BEGIN PROGRAM
...
...
CALL SUB1 // goto to SUB1 which will return here
...
...
CALL SUB5 // goto to SUB5 which will return here
...
...
END PROGRAM // End of processing
START SUB1 // Sub 1 start
...
...
END // Sub 1 end
START SUB2 // Sub 2 start
...
...
START SUB3 // Sub 3 start and Sub 2 end (Sub 3 is not nested in Sub 2)
...
...
START SUB5 // Sub 5 start and Sub 3 end (Sub 5 is not nested in sub 3)
...
...
END // Sub 5 end
Note that there is no nesting - a subroutine can not be part of another subroutine. Note also that a new
'start' statement acts like an 'end' statement for the previous subroutine, if there is one.
I would like to use folding to collapse individual subroutines. I have no problem creating syntax blocks (for the parser) that handle the START-END combination
but can not find a way to handle cases where the program has no END statements. I've tried using the START block for both start and end statements in the <Syntax Block> but the results are not correct (it collapses every other subroutine).
Is this possible?
Comments