Re: Determine if a region has invalid syntax

Eric Ludlam <[email protected]> Wed, 04 Feb 2015 08:00:49 -0500
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
On 02/04/2015 06:20 AM, Tu Do wrote:
> Hi Eric,
>
> Is there a way to determine if a selected region is syntactically 
> correct? Something that answers t or nil is good enough.

Hi,

The answer depends on the parser, and most of the parsers only scan the 
declarations, and skip the contents of functions.  Thus, if you are 
looking for correctness of "code", you are better off with flymake and a 
linter, or something similar.

If you are ok with only checking the declaration of functions, etc, 
there is a hook `semantic-unmatched-syntax-hook' that tells you when 
there is bad syntax as it is parsed.  You are probably more interested 
in `global-semantic-show-unmatched-syntax-mode'.  There are a bunch of 
fcns related to that which will probably help you with your task.

Eric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/