docs: def analyse_text(text):
          """
          Perform a structural analysis for basic Easytrieve constructs.
          """
          result = 0.0
          lines = text.split('\n')
          hasEndProc = False
          hasHeaderComment = False
          hasFile = False
          hasJob = False
          hasProc = False
          hasParm = False
          hasReport = False
  
          def isCommentLine(line):
              return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None
  
          def isEmptyLine(line):
              return not bool(line.strip())
  
          # Remove possible empty lines and header comments.
          while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])):
              if not isEmptyLine(lines[0]):
                  hasHeaderComment = True
              del lines[0]
  
          if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]):
              # Looks like an Easytrieve macro.
              result = 0.4
              if hasHeaderComment:
                  result += 0.4
          else:
              # Scan the source for lines starting with indicators.
              for line in lines:
                  words = line.split()
                  if (len(words) >= 2):
                      firstWord = words[0]
                      if not hasReport:
                          if not hasJob:
                              if not hasFile:
                                  if not hasParm:
                                      if firstWord == 'PARM':
                                          hasParm = True
                                  if firstWord == 'FILE':
                                      hasFile = True
                              if firstWord == 'JOB':
                                  hasJob = True
                          elif firstWord == 'PROC':
                              hasProc = True
                          elif firstWord == 'END-PROC':
                              hasEndProc = True
                          elif firstWord == 'REPORT':
                              hasReport = True
  
              # Weight the findings.
              if hasJob and (hasProc == hasEndProc):
                  if hasHeaderComment:
                      result += 0.1
                  if hasParm:
                      if hasProc:
                          # Found PARM, JOB and PROC/END-PROC:
                          # pretty sure this is Easytrieve.
                          result += 0.8
                      else:
                          # Found PARAM and  JOB: probably this is Easytrieve
                          result += 0.5
                  else:
                      # Found JOB and possibly other keywords: might be Easytrieve
                      result += 0.11
                      if hasParm:
                          # Note: PARAM is not a proper English word, so this is
                          # regarded a much better indicator for Easytrieve than
                          # the other words.
                          result += 0.2
                      if hasFile:
                          result += 0.01
                      if hasReport:
                          result += 0.01
          assert 0.0 <= result <= 1.0
          return result