KiCad PCB EDA Suite
lib_table_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 <lib_table_lexer.h>
10 
11 using namespace LIB_TABLE_T;
12 
13 #define TOKDEF(x) { #x, T_##x }
14 
16  TOKDEF( descr ),
17  TOKDEF( disabled ),
18  TOKDEF( fp_lib_table ),
19  TOKDEF( lib ),
20  TOKDEF( name ),
21  TOKDEF( options ),
22  TOKDEF( sym_lib_table ),
23  TOKDEF( type ),
24  TOKDEF( uri )
25 };
26 
27 const unsigned LIB_TABLE_LEXER::keyword_count = unsigned( sizeof( LIB_TABLE_LEXER::keywords )/sizeof( LIB_TABLE_LEXER::keywords[0] ) );
28 
29 
30 const char* LIB_TABLE_LEXER::TokenName( T aTok )
31 {
32  const char* ret;
33 
34  if( aTok < 0 )
35  ret = DSNLEXER::Syntax( aTok );
36  else if( (unsigned) aTok < keyword_count )
37  ret = keywords[aTok].name;
38  else
39  ret = "token too big";
40 
41  return ret;
42 }
T
enum T contains all this lexer's tokens.
static const KEYWORD keywords[]
Auto generated lexer keywords table and length:
static const char * TokenName(LIB_TABLE_T::T aTok)
Function TokenName returns the name of the token in ASCII form.
#define TOKDEF(x)
const char * name
Struct KEYWORD holds a keyword string and its unique integer token.
Definition: dsnlexer.h:40
static const unsigned keyword_count
static const char * Syntax(int aTok)
Definition: dsnlexer.cpp:271
C++ does not put enum values in separate namespaces unless the enum itself is in a separate namespace...