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