KiCad PCB EDA Suite
cmp_library_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 <cmp_library_lexer.h>
10 
11 using namespace TLIB_T;
12 
13 #define TOKDEF(x) { #x, T_##x }
14 
16  TOKDEF( arc ),
17  TOKDEF( author ),
18  TOKDEF( center ),
19  TOKDEF( circle ),
20  TOKDEF( comment ),
21  TOKDEF( component ),
22  TOKDEF( copyright ),
23  TOKDEF( docs ),
24  TOKDEF( drawing ),
25  TOKDEF( electical_type ),
26  TOKDEF( end ),
27  TOKDEF( field ),
28  TOKDEF( fill_style ),
29  TOKDEF( header ),
30  TOKDEF( height ),
31  TOKDEF( length ),
32  TOKDEF( license ),
33  TOKDEF( name ),
34  TOKDEF( number ),
35  TOKDEF( orientation ),
36  TOKDEF( pin ),
37  TOKDEF( polyline ),
38  TOKDEF( position ),
39  TOKDEF( radius ),
40  TOKDEF( rectangle ),
41  TOKDEF( start ),
42  TOKDEF( style ),
43  TOKDEF( symbol ),
44  TOKDEF( tags ),
45  TOKDEF( text ),
46  TOKDEF( url ),
47  TOKDEF( version ),
48  TOKDEF( width )
49 };
50 
51 const unsigned CMP_LIBRARY_LEXER::keyword_count = unsigned( sizeof( CMP_LIBRARY_LEXER::keywords )/sizeof( CMP_LIBRARY_LEXER::keywords[0] ) );
52 
53 
54 const char* CMP_LIBRARY_LEXER::TokenName( T aTok )
55 {
56  const char* ret;
57 
58  if( aTok < 0 )
59  ret = DSNLEXER::Syntax( aTok );
60  else if( (unsigned) aTok < keyword_count )
61  ret = keywords[aTok].name;
62  else
63  ret = "token too big";
64 
65  return ret;
66 }
#define TOKDEF(x)
static const unsigned keyword_count
static const KEYWORD keywords[]
Auto generated lexer keywords table and length:
C++ does not put enum values in separate namespaces unless the enum itself is in a separate namespace...
static const char * TokenName(TLIB_T::T aTok)
Function TokenName returns the name of the token in ASCII form.
T
enum T contains all this lexer's tokens.
Struct KEYWORD holds a keyword string and its unique integer token.
Definition: dsnlexer.h:40
static const char * Syntax(int aTok)
Definition: dsnlexer.cpp:272