KiCad PCB EDA Suite
netlist_keywords.cpp
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  * Include this file in your lexer class to provide the keywords for
6  * your DSN lexer.
7  */
8 
9 #include <netlist_lexer.h>
10 
11 using namespace NL_T;
12 
13 #define TOKDEF(x) { #x, T_##x }
14 
16  TOKDEF( alias ),
17  TOKDEF( aliases ),
18  TOKDEF( code ),
19  TOKDEF( comp ),
20  TOKDEF( components ),
21  TOKDEF( datasheet ),
22  TOKDEF( date ),
23  TOKDEF( description ),
24  TOKDEF( design ),
25  TOKDEF( docs ),
26  TOKDEF( export ),
27  TOKDEF( field ),
28  TOKDEF( fields ),
29  TOKDEF( footprint ),
30  TOKDEF( footprints ),
31  TOKDEF( fp ),
32  TOKDEF( lib ),
33  TOKDEF( libpart ),
34  TOKDEF( libparts ),
35  TOKDEF( libraries ),
36  TOKDEF( library ),
37  TOKDEF( libsource ),
38  TOKDEF( name ),
39  TOKDEF( names ),
40  TOKDEF( net ),
41  TOKDEF( nets ),
42  TOKDEF( node ),
43  TOKDEF( num ),
44  TOKDEF( part ),
45  TOKDEF( pin ),
46  TOKDEF( pins ),
47  TOKDEF( ref ),
48  TOKDEF( sheetpath ),
49  TOKDEF( source ),
50  TOKDEF( tool ),
51  TOKDEF( tstamp ),
52  TOKDEF( tstamps ),
53  TOKDEF( uri ),
54  TOKDEF( value ),
55  TOKDEF( version )
56 };
57 
58 const unsigned NETLIST_LEXER::keyword_count = unsigned( sizeof( NETLIST_LEXER::keywords )/sizeof( NETLIST_LEXER::keywords[0] ) );
59 
60 
61 const char* NETLIST_LEXER::TokenName( T aTok )
62 {
63  const char* ret;
64 
65  if( aTok < 0 )
66  ret = DSNLEXER::Syntax( aTok );
67  else if( (unsigned) aTok < keyword_count )
68  ret = keywords[aTok].name;
69  else
70  ret = "token too big";
71 
72  return ret;
73 }
static const unsigned keyword_count
Definition: netlist_lexer.h:96
static const char * TokenName(NL_T::T aTok)
Function TokenName returns the name of the token in ASCII form.
T
enum T contains all this lexer's tokens.
Definition: netlist_lexer.h:26
#define TOKDEF(x)
C++ does not put enum values in separate namespaces unless the enum itself is in a separate namespace...
Definition: netlist_lexer.h:23
const char * name
Struct KEYWORD holds a keyword string and its unique integer token.
Definition: dsnlexer.h:40
static const KEYWORD keywords[]
Auto generated lexer keywords table and length:
Definition: netlist_lexer.h:95
static const char * Syntax(int aTok)
Definition: dsnlexer.cpp:271