KiCad PCB EDA Suite
netlist_lexer.h
Go to the documentation of this file.
1 
2 /* Do not modify this file it was automatically generated by the
3  * TokenList2DsnLexer CMake script.
4  */
5 
6 #ifndef NETLIST_LEXER_H_
7 #define NETLIST_LEXER_H_
8 
9 #include <dsnlexer.h>
10 
23 namespace NL_T
24 {
26  enum T
27  {
28  // these first few are negative special ones for syntax, and are
29  // inherited from DSNLEXER.
37  T_RIGHT = DSN_RIGHT, // right bracket: ')'
38  T_LEFT = DSN_LEFT, // left bracket: '('
39  T_STRING = DSN_STRING, // a quoted string, stripped of the quotes
40  T_EOF = DSN_EOF, // special case for end of file
41 
42  T_alias = 0,
82  };
83 } // namespace NL_T
84 
85 
92 class NETLIST_LEXER : public DSNLEXER
93 {
95  static const KEYWORD keywords[];
96  static const unsigned keyword_count;
97 
98 public:
105  NETLIST_LEXER( const std::string& aSExpression, const wxString& aSource = wxEmptyString ) :
106  DSNLEXER( keywords, keyword_count, aSExpression, aSource )
107  {
108  }
109 
119  NETLIST_LEXER( FILE* aFile, const wxString& aFilename ) :
120  DSNLEXER( keywords, keyword_count, aFile, aFilename )
121  {
122  }
123 
135  NETLIST_LEXER( LINE_READER* aLineReader ) :
136  DSNLEXER( keywords, keyword_count, aLineReader )
137  {
138  }
139 
144  static const char* TokenName( NL_T::T aTok );
145 
157  {
158  return (NL_T::T) DSNLEXER::NextTok();
159  }
160 
170  {
171  return (NL_T::T) DSNLEXER::NeedSYMBOL();
172  }
173 
183  {
185  }
186 
192  {
193  return (NL_T::T) DSNLEXER::CurTok();
194  }
195 
201  {
202  return (NL_T::T) DSNLEXER::PrevTok();
203  }
204 };
205 
206 // example usage
207 
218 #endif // NETLIST_LEXER_H_
NL_T::T PrevTok()
Function PrevTok returns whatever NextTok() returned the 2nd to last time it was called.
static const unsigned keyword_count
Definition: netlist_lexer.h:96
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
static const char * TokenName(NL_T::T aTok)
Function TokenName returns the name of the token in ASCII form.
int NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
Definition: dsnlexer.cpp:418
Class NETLIST_LEXER is an automatically generated class using the TokenList2DnsLexer.cmake technology, based on keywords provided by file: /home/kicad/workspace/kicad-doxygen/common/netlist.keywords.
Definition: netlist_lexer.h:92
int PrevTok()
Function PrevTok returns whatever NextTok() returned the 2nd to last time it was called.
Definition: dsnlexer.h:329
NL_T::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
int NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
Definition: dsnlexer.cpp:409
int CurTok()
Function CurTok returns whatever NextTok() returned the last time it was called.
Definition: dsnlexer.h:320
NETLIST_LEXER(FILE *aFile, const wxString &aFilename)
Constructor ( FILE* ) takes aFile already opened for reading and aFilename as parameters.
NL_T::T CurTok()
Function CurTok returns whatever NextTok() returned the last time it was called.
T
enum T contains all this lexer's tokens.
Definition: netlist_lexer.h:26
NL_T::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
NETLIST_LEXER(const std::string &aSExpression, const wxString &aSource=wxEmptyString)
Constructor ( const std::string&, const wxString& )
NETLIST_LEXER(LINE_READER *aLineReader)
Constructor ( LINE_READER* ) intializes a lexer and prepares to read from aLineReader which is assume...
NL_T::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
C++ does not put enum values in separate namespaces unless the enum itself is in a separate namespace...
Definition: netlist_lexer.h:23
int NextTok()
Function NextTok returns the next token found in the input file or DSN_EOF when reaching the end of f...
Definition: dsnlexer.cpp:540
Struct KEYWORD holds a keyword string and its unique integer token.
Definition: dsnlexer.h:40
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
Class DSNLEXER implements a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:79
static const KEYWORD keywords[]
Auto generated lexer keywords table and length:
Definition: netlist_lexer.h:95