LCOV - code coverage report
Current view: top level - libreoffice/workdir/unxlngi6.pro/UnpackedTarball/python3/Parser - grammar1.c (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 16 18.8 %
Date: 2012-12-17 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : 
       2             : /* Grammar subroutines needed by parser */
       3             : 
       4             : #include "Python.h"
       5             : #include "pgenheaders.h"
       6             : #include "grammar.h"
       7             : #include "token.h"
       8             : 
       9             : /* Return the DFA for the given type */
      10             : 
      11             : dfa *
      12        7616 : PyGrammar_FindDFA(grammar *g, register int type)
      13             : {
      14             :     register dfa *d;
      15             : #if 1
      16             :     /* Massive speed-up */
      17        7616 :     d = &g->g_dfa[type - NT_OFFSET];
      18             :     assert(d->d_type == type);
      19        7616 :     return d;
      20             : #else
      21             :     /* Old, slow version */
      22             :     register int i;
      23             : 
      24             :     for (i = g->g_ndfas, d = g->g_dfa; --i >= 0; d++) {
      25             :         if (d->d_type == type)
      26             :             return d;
      27             :     }
      28             :     assert(0);
      29             :     /* NOTREACHED */
      30             : #endif
      31             : }
      32             : 
      33             : char *
      34           0 : PyGrammar_LabelRepr(label *lb)
      35             : {
      36             :     static char buf[100];
      37             : 
      38           0 :     if (lb->lb_type == ENDMARKER)
      39           0 :         return "EMPTY";
      40           0 :     else if (ISNONTERMINAL(lb->lb_type)) {
      41           0 :         if (lb->lb_str == NULL) {
      42           0 :             PyOS_snprintf(buf, sizeof(buf), "NT%d", lb->lb_type);
      43           0 :             return buf;
      44             :         }
      45             :         else
      46           0 :             return lb->lb_str;
      47             :     }
      48             :     else {
      49           0 :         if (lb->lb_str == NULL)
      50           0 :             return _PyParser_TokenNames[lb->lb_type];
      51             :         else {
      52           0 :             PyOS_snprintf(buf, sizeof(buf), "%.32s(%.32s)",
      53           0 :                 _PyParser_TokenNames[lb->lb_type], lb->lb_str);
      54           0 :             return buf;
      55             :         }
      56             :     }
      57             : }

Generated by: LCOV version 1.10