Detect the length of a lambda expression using Roslyn

I'm wondering how could one possibly detect the length (number of lines) when analyzing code using the Roslyn compiler. At the moment, I'm developing a law which prohibited the use of lambdas longer than 10 lines.

Looking at the example below, how could I know that the simple lambda expression syntax has only one line ?

        // Data source. 
        int[] scores = { 90, 71, 82, 93, 75, 82 };

        // The call to Count forces iteration of the source 
        int highScoreCount = scores.Where(n => n > 80).Count();

EDITS What I would like to know, is exactly know the difference in the number of lines we can see in the lambda expression in the first example and in the one just below :

   1: private IEnumerable<Book> BooksPublishedBetween1991and1997()
   2: {
   3:     return Books.FindAll(Book => {
   4:  
   5:         return Book.Published >= new DateTime(1991, 01, 01) &&
   6:         Book.Published <= new DateTime(1997, 12, 31);
   7:     
   8:     });
   9: } //Link to sample :  http://www.rvenables.com/2009/03/practical-introduction-to-lambda-expressions/

UPDATE

It has been pointing out in the comments that my question is too broad. I'm going to try to simply it as much as I can. I have done code analysis before using Roslyn to validate certain development usage users should have when developing client software. I have a general way to go through the nodes of the tree code (not sure if it's really called like that) by using a SyntaxNodeAnalysisContext object. What I would like to know is when I'm looking for SimpleLambdaExpressionSyntax and ParenthesisedLambdaExpressionSyntax, is the way to look at the content of the lambda expression and know exactly on how many lines the code was written.

Jon Skeet
people
quotationmark

It sounds like you know how to get to the relevant syntax nodes (SimpleLambdaExpressionSyntax and ParenthesizedLambdaExpressionSyntax) and just need to know how long they are.

I think you just want something like this:

var lineSpan = node.SyntaxTree.GetMappedLineSpan(node.Span);
var lines = lineSpan.EndLinePosition.Line - lineSpan.StartLinePosition.Line + 1;

There may be a more efficient or simpler way of doing it, but that should get you started.

people

See more on this question at Stackoverflow