How to define recursive Child States in the Language Designer

SyntaxEditor for WPF Forum

Posted 5 years ago by Hank Drews
Version: 14.2.0610
Avatar

I'm trying to create an Oracle pl/sql lexer/parser.   I think I have th elexer portion down.   Howeve, I trying to add in addition child states to handle the following:

begin
   <code>
end;

-- -----------------------

for i in 1..10
loop
   <code>
end loop;

-- -----------------------

while x
loop
   <code>
end loop;

-- -----------------------

case x
    <case code>
end case;

loop
   <code>
end loop;

-- -----------------------

if x
   <code>
end if;

 where each of these code fragements is a beginning and ending "delimiter" for outlining use.   <code> can contain any valid pl/sql code including any of the above code fragements.   I thought I doing this correctly but when I add in the scopes as child states to the Default scope, the lexer breaks.

 

Can this be accomplished with the current language definer tool?

Comments (1)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Hank,

Generally when you make a lexer, you want to just define patterns for the keywords, identifiers, etc. and not get into structural considerations.  Structure is meant to be enforced by a parser that consumes the tokens.  I would recommend that your default state allow all the various keywords and then in your parser phase later on, you make your parser grammar look for them to be in proper structure and return parse errors when they are not.  It will greatly simplify the lexer and make it better for use in a control like SyntaxEditor too.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.