doctokenizer.h 3.75 KB
Newer Older
1 2
/******************************************************************************
 *
3
 * 
4 5
 *
 *
6
 * Copyright (C) 1997-2008 by Dimitri van Heesch.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef _DOCTOKENIZER_H
#define _DOCTOKENIZER_H

22
#include <qstring.h>
23
#include <qlist.h>
24
#include "htmlattrib.h"
25

26 27 28
class Definition;
class MemberGroup;

29 30 31
enum Tokens
{
  TK_WORD          = 1,
32 33 34 35 36 37 38 39 40 41
  TK_LNKWORD       = 2,
  TK_WHITESPACE    = 3,
  TK_LISTITEM      = 4,
  TK_ENDLIST       = 5,
  TK_COMMAND       = 6,
  TK_HTMLTAG       = 7,
  TK_SYMBOL        = 8,
  TK_NEWPARA       = 9,
  TK_RCSTAG        = 10,
  TK_URL           = 11,
42

43 44 45 46 47 48 49
  RetVal_OK             = 0x10000,
  RetVal_SimpleSec      = 0x10001,
  RetVal_ListItem       = 0x10002,
  RetVal_Section        = 0x10003,
  RetVal_Subsection     = 0x10004,
  RetVal_Subsubsection  = 0x10005,
  RetVal_Paragraph      = 0x10006,
50 51 52 53 54 55 56 57 58 59 60 61 62
  RetVal_SubParagraph   = 0x10007,
  RetVal_EndList        = 0x10008,
  RetVal_EndPre         = 0x10009,
  RetVal_DescData       = 0x1000A,
  RetVal_DescTitle      = 0x1000B,
  RetVal_EndDesc        = 0x1000C,
  RetVal_TableRow       = 0x1000D,
  RetVal_TableCell      = 0x1000E,
  RetVal_TableHCell     = 0x1000F,
  RetVal_EndTable       = 0x10010,
  RetVal_Internal       = 0x10011,
  RetVal_SwitchLang     = 0x10012,
  RetVal_CloseXml       = 0x10013
63 64 65 66 67 68 69 70
};

struct TokenInfo
{
  // unknown token
  char unknownChar;
  
  // command token
71
  QString name;
72 73

  // command text (RCS tag)
74
  QString text;
75 76 77 78 79 80 81 82

  // comment blocks
  
  // list token info
  bool isEnumList;
  int indent;

  // sections
83
  QString sectionId;
84 85

  // simple section
86
  QString simpleSectName;
87
  QString simpleSectText;
88 89

  // verbatim fragment
90
  QString verb;
91 92 93 94 95

  // xrefitem
  int id;

  // html tag
96
  HtmlAttribList attribs;
97
  bool endTag;
98
  bool emptyTag;
99 100

  // whitespace
101
  QString chars;
102 103 104

  // url
  bool isEMailAddr;
105 106 107 108

  // param attributes
  enum ParamDir { In=1, Out=2, InOut=3, Unspecified=0 };
  ParamDir paramDir;
109 110 111 112 113 114 115 116 117 118 119
};

// globals
extern TokenInfo *g_token;
extern int doctokenizerYYlineno;
extern FILE *doctokenizerYYin;

// helper functions
const char *tokToString(int token);

// operations on the scanner
120
void doctokenizerYYFindSections(const char *input,Definition *d,
121
                                MemberGroup *mg,const char *fileName);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
122
void doctokenizerYYinit(const char *input,const char *fileName);
123 124 125 126 127 128
void doctokenizerYYcleanup();
void doctokenizerYYpushContext();
bool doctokenizerYYpopContext();
int  doctokenizerYYlex();
void doctokenizerYYsetStatePara();
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 140 141 142 143 144
void doctokenizerYYsetStateParam();
void doctokenizerYYsetStateXRefItem();
void doctokenizerYYsetStateFile();
void doctokenizerYYsetStatePattern();
void doctokenizerYYsetStateLink();
void doctokenizerYYsetStateRef();
145
void doctokenizerYYsetStateInternalRef();
146
void doctokenizerYYsetStateText();
147 148
void doctokenizerYYsetStateSkipTitle();
void doctokenizerYYsetInsidePre(bool b);
149
void doctokenizerYYpushBackHtmlTag(const char *tag);
150 151

#endif