Missing comment end

SyntaxEditor for WPF Forum

Posted 7 years ago by Daisuke Nakada
Version: 17.2.0664
Avatar

Hi,

I'm using the LL(*) Parser Framework.

My language's multi line comment starts with (* and ends with *).

Or starts with /* and ends with */.

(*
    multi line comment
*)

/*
    multi line comment
*/   

 

Is it possible to detect missing comment end?

Thank you.

Comments (2)

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

Hello,

Wouldn't a missing multi-line comment end go through the end of the document? 

If so, the thing is that token readers will generally filter out comments from ever reaching the parser.  That being said, you could store the text range in the token reader of the last multi-line comment that was found in GetNextToken.  Then in your custom parser class, override InitializeParseData and look at the state.TokenReader.LastCommentTextRange (or whatever you named the property) and see if it aligns with the end of the snapshot that was passed in state.Snapshot.  If so, use the snapshot to see the last couple characters of the text range and if they don't match the expected delimiter based on the starting delimiter, then report an error in the state.  That might work.


Actipro Software Support

Posted 7 years ago by Daisuke Nakada
Avatar

Thank you for your suggestion!

The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.