Orb/Doxygen/src/doctokenizer.h
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  *
       
     6  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     7  *
       
     8  * Permission to use, copy, modify, and distribute this software and its
       
     9  * documentation under the terms of the GNU General Public License is hereby 
       
    10  * granted. No representations are made about the suitability of this software 
       
    11  * for any purpose. It is provided "as is" without express or implied warranty.
       
    12  * See the GNU General Public License for more details.
       
    13  *
       
    14  * Documents produced by Doxygen are derivative works derived from the
       
    15  * input used in their production; they are not affected by this license.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef _DOCTOKENIZER_H
       
    20 #define _DOCTOKENIZER_H
       
    21 
       
    22 #include <qstring.h>
       
    23 #include <qlist.h>
       
    24 #include "htmlattrib.h"
       
    25 
       
    26 class Definition;
       
    27 class MemberGroup;
       
    28 
       
    29 enum Tokens
       
    30 {
       
    31   TK_WORD          = 1,
       
    32   TK_LNKWORD       = 2,
       
    33   TK_WHITESPACE    = 3,
       
    34   TK_LISTITEM      = 4,
       
    35   TK_ENDLIST       = 5,
       
    36   TK_COMMAND       = 6,
       
    37   TK_HTMLTAG       = 7,
       
    38   TK_SYMBOL        = 8,
       
    39   TK_NEWPARA       = 9,
       
    40   TK_RCSTAG        = 10,
       
    41   TK_URL           = 11,
       
    42 
       
    43   RetVal_OK             = 0x10000,
       
    44   RetVal_SimpleSec      = 0x10001,
       
    45   RetVal_ListItem       = 0x10002,
       
    46   RetVal_Section        = 0x10003,
       
    47   RetVal_Subsection     = 0x10004,
       
    48   RetVal_Subsubsection  = 0x10005,
       
    49   RetVal_Paragraph      = 0x10006,
       
    50   RetVal_SubParagraph   = 0x10007,
       
    51   RetVal_EndList        = 0x10008,
       
    52   RetVal_EndPre         = 0x10009,
       
    53   RetVal_DescData       = 0x1000A,
       
    54   RetVal_DescTitle      = 0x1000B,
       
    55   RetVal_EndDesc        = 0x1000C,
       
    56   RetVal_TableRow       = 0x1000D,
       
    57   RetVal_TableCell      = 0x1000E,
       
    58   RetVal_TableHCell     = 0x1000F,
       
    59   RetVal_EndTable       = 0x10010,
       
    60   RetVal_Internal       = 0x10011,
       
    61   RetVal_SwitchLang     = 0x10012,
       
    62   RetVal_CloseXml       = 0x10013
       
    63 };
       
    64 
       
    65 struct TokenInfo
       
    66 {
       
    67   // unknown token
       
    68   char unknownChar;
       
    69   
       
    70   // command token
       
    71   QString name;
       
    72 
       
    73   // command text (RCS tag)
       
    74   QString text;
       
    75 
       
    76   // comment blocks
       
    77   
       
    78   // list token info
       
    79   bool isEnumList;
       
    80   int indent;
       
    81 
       
    82   // sections
       
    83   QString sectionId;
       
    84 
       
    85   // simple section
       
    86   QString simpleSectName;
       
    87   QString simpleSectText;
       
    88 
       
    89   // verbatim fragment
       
    90   QString verb;
       
    91 
       
    92   // xrefitem
       
    93   int id;
       
    94 
       
    95   // html tag
       
    96   HtmlAttribList attribs;
       
    97   bool endTag;
       
    98   bool emptyTag;
       
    99 
       
   100   // whitespace
       
   101   QString chars;
       
   102 
       
   103   // url
       
   104   bool isEMailAddr;
       
   105 
       
   106   // param attributes
       
   107   enum ParamDir { In=1, Out=2, InOut=3, Unspecified=0 };
       
   108   ParamDir paramDir;
       
   109 };
       
   110 
       
   111 // globals
       
   112 extern TokenInfo *g_token;
       
   113 extern int doctokenizerYYlineno;
       
   114 extern FILE *doctokenizerYYin;
       
   115 
       
   116 // helper functions
       
   117 const char *tokToString(int token);
       
   118 
       
   119 // operations on the scanner
       
   120 void doctokenizerYYFindSections(const char *input,Definition *d,
       
   121                                 MemberGroup *mg,const char *fileName);
       
   122 void doctokenizerYYinit(const char *input,const char *fileName);
       
   123 void doctokenizerYYcleanup();
       
   124 void doctokenizerYYpushContext();
       
   125 bool doctokenizerYYpopContext();
       
   126 int  doctokenizerYYlex();
       
   127 void doctokenizerYYsetStatePara();
       
   128 void doctokenizerYYsetStateTitle();
       
   129 void doctokenizerYYsetStateTitleAttrValue();
       
   130 void doctokenizerYYsetStateCode();
       
   131 void doctokenizerYYsetStateXmlCode();
       
   132 void doctokenizerYYsetStateHtmlOnly();
       
   133 void doctokenizerYYsetStateManOnly();
       
   134 void doctokenizerYYsetStateLatexOnly();
       
   135 void doctokenizerYYsetStateXmlOnly();
       
   136 void doctokenizerYYsetStateVerbatim();
       
   137 void doctokenizerYYsetStateDot();
       
   138 void doctokenizerYYsetStateMsc();
       
   139 void doctokenizerYYsetStateParam();
       
   140 void doctokenizerYYsetStateXRefItem();
       
   141 void doctokenizerYYsetStateFile();
       
   142 void doctokenizerYYsetStatePattern();
       
   143 void doctokenizerYYsetStateLink();
       
   144 void doctokenizerYYsetStateRef();
       
   145 void doctokenizerYYsetStateInternalRef();
       
   146 void doctokenizerYYsetStateText();
       
   147 void doctokenizerYYsetStateSkipTitle();
       
   148 void doctokenizerYYsetInsidePre(bool b);
       
   149 void doctokenizerYYpushBackHtmlTag(const char *tag);
       
   150 
       
   151 #endif