Commit c72857f4 authored by dickelbeck's avatar dickelbeck

more specctra dsn work

parent f5f6bb6f
...@@ -46,11 +46,13 @@ namespace DSN { ...@@ -46,11 +46,13 @@ namespace DSN {
struct KEYWORD struct KEYWORD
{ {
const char* name; const char* name;
int token; // int token;
}; };
#define TOKDEF(x) { #x, T_##x } //#define TOKDEF(x) { #x, T_##x }
#define TOKDEF(x) { #x }
// This MUST be sorted alphabetically, and also so MUST enum DSN_T {} be alphabetized. // This MUST be sorted alphabetically, and also so MUST enum DSN_T {} be alphabetized.
// These MUST all be lower case because of the conversion to lowercase in findToken(). // These MUST all be lower case because of the conversion to lowercase in findToken().
...@@ -123,6 +125,7 @@ const static KEYWORD tokens[] = { ...@@ -123,6 +125,7 @@ const static KEYWORD tokens[] = {
TOKDEF(diagonal), TOKDEF(diagonal),
TOKDEF(direction), TOKDEF(direction),
TOKDEF(directory), TOKDEF(directory),
TOKDEF(discrete),
TOKDEF(effective_via_length), TOKDEF(effective_via_length),
TOKDEF(exclude), TOKDEF(exclude),
TOKDEF(expose), TOKDEF(expose),
...@@ -163,6 +166,7 @@ const static KEYWORD tokens[] = { ...@@ -163,6 +166,7 @@ const static KEYWORD tokens[] = {
TOKDEF(image_image), TOKDEF(image_image),
TOKDEF(image_image_spacing), TOKDEF(image_image_spacing),
TOKDEF(image_outline_clearance), TOKDEF(image_outline_clearance),
TOKDEF(image_set),
TOKDEF(image_type), TOKDEF(image_type),
TOKDEF(inch), TOKDEF(inch),
TOKDEF(include), TOKDEF(include),
...@@ -310,6 +314,7 @@ const static KEYWORD tokens[] = { ...@@ -310,6 +314,7 @@ const static KEYWORD tokens[] = {
TOKDEF(reorder), TOKDEF(reorder),
TOKDEF(reroute_order_viols), TOKDEF(reroute_order_viols),
TOKDEF(resistance_resolution), TOKDEF(resistance_resolution),
TOKDEF(resistor),
TOKDEF(resolution), TOKDEF(resolution),
TOKDEF(restricted_layer_length_factor), TOKDEF(restricted_layer_length_factor),
TOKDEF(room), TOKDEF(room),
...@@ -341,6 +346,7 @@ const static KEYWORD tokens[] = { ...@@ -341,6 +346,7 @@ const static KEYWORD tokens[] = {
TOKDEF(side), TOKDEF(side),
TOKDEF(signal), TOKDEF(signal),
TOKDEF(site), TOKDEF(site),
TOKDEF(small),
TOKDEF(smd), TOKDEF(smd),
TOKDEF(snap), TOKDEF(snap),
TOKDEF(snap_angle), TOKDEF(snap_angle),
...@@ -420,6 +426,7 @@ const static KEYWORD tokens[] = { ...@@ -420,6 +426,7 @@ const static KEYWORD tokens[] = {
TOKDEF(wiring), TOKDEF(wiring),
TOKDEF(write_resolution), TOKDEF(write_resolution),
TOKDEF(x), TOKDEF(x),
TOKDEF(xy),
TOKDEF(y), TOKDEF(y),
}; };
...@@ -513,7 +520,8 @@ int LEXER::findToken( const std::string& tok ) ...@@ -513,7 +520,8 @@ int LEXER::findToken( const std::string& tok )
tokens, sizeof(tokens)/sizeof(tokens[0]), tokens, sizeof(tokens)/sizeof(tokens[0]),
sizeof(KEYWORD), compare ); sizeof(KEYWORD), compare );
if( findings ) if( findings )
return findings->token; // return findings->token;
return findings - tokens;
else else
return -1; return -1;
} }
......
...@@ -42,6 +42,7 @@ namespace DSN { ...@@ -42,6 +42,7 @@ namespace DSN {
enum DSN_T { enum DSN_T {
// the first few are special (the uppercase ones) // the first few are special (the uppercase ones)
T_NONE = -9,
T_QUOTE_DEF = -8, T_QUOTE_DEF = -8,
T_DASH = -7, T_DASH = -7,
T_SYMBOL = -6, T_SYMBOL = -6,
...@@ -123,6 +124,7 @@ enum DSN_T { ...@@ -123,6 +124,7 @@ enum DSN_T {
T_diagonal, T_diagonal,
T_direction, T_direction,
T_directory, T_directory,
T_discrete,
T_effective_via_length, T_effective_via_length,
T_exclude, T_exclude,
T_expose, T_expose,
...@@ -163,6 +165,7 @@ enum DSN_T { ...@@ -163,6 +165,7 @@ enum DSN_T {
T_image_image, T_image_image,
T_image_image_spacing, T_image_image_spacing,
T_image_outline_clearance, T_image_outline_clearance,
T_image_set,
T_image_type, T_image_type,
T_inch, T_inch,
T_include, T_include,
...@@ -310,6 +313,7 @@ enum DSN_T { ...@@ -310,6 +313,7 @@ enum DSN_T {
T_reorder, T_reorder,
T_reroute_order_viols, T_reroute_order_viols,
T_resistance_resolution, T_resistance_resolution,
T_resistor,
T_resolution, T_resolution,
T_restricted_layer_length_factor, T_restricted_layer_length_factor,
T_room, T_room,
...@@ -341,6 +345,7 @@ enum DSN_T { ...@@ -341,6 +345,7 @@ enum DSN_T {
T_side, T_side,
T_signal, T_signal,
T_site, T_site,
T_small,
T_smd, T_smd,
T_snap, T_snap,
T_snap_angle, T_snap_angle,
...@@ -420,6 +425,7 @@ enum DSN_T { ...@@ -420,6 +425,7 @@ enum DSN_T {
T_wiring, T_wiring,
T_write_resolution, T_write_resolution,
T_x, T_x,
T_xy,
T_y, T_y,
T_END // just a sentinel, not a token T_END // just a sentinel, not a token
}; };
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment