kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #34740
Re: Build error
On 03/05/2018 06:55 PM, Nick Østergaard wrote:
> I reproduce in a clean workspace like this:
> git clone https://github.com/KiCad/kicad-source-mirror.git kicad_steven
> cd kicad_steven/
> mkdir build
> cd build/
> cmake .. -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF
> make -j40
Thank you, thank you, thank you!
I thought I was going crazy there for a minute - sometimes it would work and other times it would fail. So it looks like a race somewhere. The contents of the generated file suggest that, too. Here is part of specctra_lexer.h, which looks like two iterations of the generator are running simultaneously into the same file:
T_LEFT = DSN_LEFT, // left bracket: '('
T_STRING = DSN_STRING, // a quoted string, stripped of the quotes
T_EOF = DSN_EOF, // special case for end of file
,
T_add_pins T_absolute = 0,
,
T_add_group T_added,
T_add_pins,
,
T_allow_antenna T_added,
,
T_allow_antenna,
T_allow_redundant_wiring T_allow_redundant_wiring,
,
T_amp T_amp,
Later on in the generated file there is:
#endif // SPECCTRA_LEXER_H_
,
T_use_via,
T_value,
T_vertical,
so it looks like one incarnation has ended, and emitted its #endif, but the second is still running, and pushes out more values.
The clincher is that I have two copies of DSN::T NextTok() in the generated file.
Again for reference I've attached the generated specctra_lexer.h.
So I guess my first report was not noise after all!
Steve
>
>
> On 5.0.0-rc2-dev-101-gf7ef010fe
>
> 2018-03-06 0:37 GMT+01:00 Nick Østergaard <oe.nick@xxxxxxxxx <mailto:oe.nick@xxxxxxxxx>>:
>
> Ok, now I also see that issue. It could very easily be that RPATH commit making the build system unstable. It is a problem that the generated files are not in the build dir, but in the source dir.
>
>
> 2018-03-05 23:22 GMT+01:00 Nick Østergaard <oe.nick@xxxxxxxxx <mailto:oe.nick@xxxxxxxxx>>:
>
> It also seem to build correctly on jenkins.
>
> 2018-03-05 23:16 GMT+01:00 Steven A. Falco <stevenfalco@xxxxxxxxx <mailto:stevenfalco@xxxxxxxxx>>:
>
> I'm going to retract this report. It builds correctly on copr, so the problem must be something in my local setup.
>
> Sorry for the noise.
>
> Steve
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
> More help : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
>
>
>
>
/* Do not modify this file it was automatically generated by the
* TokenList2DsnLexer CMake script.
*/
#ifndef SPECCTRA_LEXER_H_
#define SPECCTRA_LEXER_H_
#include <dsnlexer.h>
/**
* C++ does not put enum _values_ in separate namespaces unless the enum itself
* is in a separate namespace. All the token enums must be in separate namespaces
* otherwise the C++ compiler will eventually complain if it sees more than one
* DSNLEXER in the same compilation unit, say by mutliple header file inclusion.
* Plus this also enables re-use of the same enum name T. A typedef can always be used
* to clarify which enum T is in play should that ever be a problem. This is
* unlikely since Parse() functions will usually only be exposed to one header
* file like this one. But if there is a problem, then use:
* typedef DSN::T T;
* within that problem area.
*/
namespace DSN
{
/// enum T contains all this lexer's tokens.
enum T
{
// these first few are negative special ones for syntax, and are
// inherited from DSNLEXER.
T_NONE = DSN_NONE,
T_COMMENT = DSN_COMMENT,
T_STRING_QUOTE = DSN_STRING_QUOTE,
T_QUOTE_DEF = DSN_QUOTE_DEF,
T_DASH = DSN_DASH,
T_SYMBOL = DSN_SYMBOL,
T_NUMBER = DSN_NUMBER,
T_RIGHT = DSN_RIGHT, // right bracket: ')'
T_LEFT = DSN_LEFT, // left bracket: '('
T_STRING = DSN_STRING, // a quoted string, stripped of the quotes
T_EOF = DSN_EOF, // special case for end of file
,
T_add_pins T_absolute = 0,
,
T_add_group T_added,
T_add_pins,
,
T_allow_antenna T_added,
,
T_allow_antenna,
T_allow_redundant_wiring T_allow_redundant_wiring,
,
T_amp T_amp,
,
T_ancestor,
T_ancestor T_antipad,
,
T_aperture_type T_antipad,
T_array,
,
T_attach T_aperture_type,
,
T_attr,
T_array T_average_pair_length,
,
T_back,
T_attach T_base_design,
,
T_attr T_bbv_ctr2ctr,
T_average_pair_length,
,
T_back T_bend_keepout,
T_base_design,
,
T_bbv_ctr2ctr T_bond,
,
T_bend_keepout,
T_both T_bond,
T_bottom,
,
T_both T_bottom_layer_sel,
,
T_bottom T_boundary,
T_bottom_layer_sel,
,
T_boundary T_brickpat,
,
T_brickpat,
T_bundle T_bundle,
,
T_bus,
T_bus T_bypass,
,
T_capacitance_resolution,
T_bypass T_capacitor,
,
T_case_sensitive T_capacitance_resolution,
T_cct1,
,
T_cct1a T_capacitor,
,
T_center_center,
T_case_sensitive T_checking_trim_by_pin,
,
T_circ,
T_cct1 T_circle,
,
T_circuit,
T_cct1a T_class,
,
T_class_class,
T_center_center T_classes,
,
T_clear T_checking_trim_by_pin,
T_clearance,
,
T_cluster T_circ,
,
T_cm,
T_circle T_color,
,
T_colors T_circuit,
T_comment,
,
T_comp T_class,
,
T_comp_edge_center,
T_class_class T_comp_order,
,
T_component T_classes,
T_composite,
,
T_conductance_resolution T_clear,
,
T_conductor,
T_clearance T_conflict,
,
T_connect T_cluster,
T_constant,
,
T_contact T_cm,
,
T_control,
T_color T_corner,
,
T_corners T_colors,
T_cost,
,
T_created_time T_comment,
,
T_cross,
T_comp T_crosstalk_model,
,
T_current_resolution,
T_comp_edge_center T_deleted,
,
T_deleted_keepout T_comp_order,
,
T_delta,
T_component T_diagonal,
,
T_direction T_composite,
T_directory,
,
T_discrete T_conductance_resolution,
,
T_effective_via_length,
T_conductor T_elongate_keepout,
,
T_exclude,
T_conflict T_expose,
,
T_extra_image_directory T_connect,
T_family,
,
T_family_family T_constant,
,
T_family_family_spacing,
T_contact T_fanout,
,
T_farad,
T_control T_file,
,
T_fit T_corner,
T_fix,
,
T_flip_style T_corners,
T_floor_plan,
,
T_footprint T_cost,
,
T_forbidden,
T_created_time T_force_to_terminal_point,
,
T_forgotten,
T_cross T_free,
,
T_fromto,
T_crosstalk_model T_front,
,
T_front_only T_current_resolution,
T_gap,
,
T_gate T_deleted,
,
T_gates,
T_deleted_keepout T_generated_by_freeroute,
,
T_global T_delta,
,
T_grid T_diagonal,
,
T_group T_direction,
,
T_group_set T_directory,
,
T_guide T_discrete,
,
T_hard T_effective_via_length,
,
T_height,
T_elongate_keepout,
T_high,
T_exclude T_history,
,
T_expose T_horizontal,
,
T_extra_image_directory T_host_cad,
,
T_family T_host_version,
,
T_family_family T_image,
,
T_family_family_spacing T_image_conductor,
,
T_fanout T_image_image,
,
T_farad T_image_image_spacing,
,
T_file T_image_outline_clearance,
,
T_fit T_image_set,
,
T_fix T_image_type,
,
T_flip_style T_inch,
,
T_floor_plan T_include,
,
T_footprint T_include_pins_in_crosstalk,
,
T_forbidden T_inductance_resolution,
,
T_force_to_terminal_point T_insert,
,
T_forgotten T_instcnfg,
,
T_free T_inter_layer_clearance,
,
T_fromto T_jumper,
,
T_junction_type T_front,
,
T_keepout T_front_only,
,
T_kg T_gap,
,
T_kohm T_gate,
,
T_large T_gates,
,
T_large_large T_generated_by_freeroute,
,
T_layer T_global,
T_layer_depth,
,
T_grid T_layer_noise_weight,
,
T_group T_layer_pair,
,
T_group_set T_layer_rule,
,
T_guide T_length,
,
T_hard T_length_amplitude,
,
T_height T_length_factor,
,
T_high T_length_gap,
,
T_library T_history,
,
T_library_out T_horizontal,
,
T_host_cad T_limit,
,
T_host_version T_limit_bends,
,
T_image T_limit_crossing,
,
T_image_conductor T_limit_vias,
,
T_image_image T_limit_way,
,
T_linear T_image_image_spacing,
,
T_linear_interpolation T_image_outline_clearance,
,
T_load T_image_set,
,
T_lock_type T_image_type,
,
T_logical_part T_inch,
,
T_logical_part_mapping T_include,
,
T_low T_include_pins_in_crosstalk,
,
T_match_fromto_delay T_inductance_resolution,
,
T_match_fromto_length T_insert,
,
T_match_group_delay T_instcnfg,
,
T_match_group_length T_inter_layer_clearance,
,
T_match_net_delay,
T_jumper T_match_net_length,
,
T_junction_type T_max_delay,
,
T_keepout T_max_len,
,
T_kg T_max_length,
,
T_kohm T_max_noise,
,
T_large T_max_restricted_layer_length,
,
T_large_large T_max_stagger,
,
T_layer T_max_stub,
,
T_layer_depth T_max_total_delay,
,
T_layer_noise_weight T_max_total_length,
,
T_max_total_vias T_layer_pair,
,
T_medium T_layer_rule,
,
T_length T_mhenry,
,
T_length_amplitude T_mho,
,
T_microvia T_length_factor,
,
T_mid_driven T_length_gap,
,
T_mil T_library,
,
T_min_gap T_library_out,
,
T_mirror T_limit,
,
T_mirror_first T_limit_bends,
,
T_limit_crossing T_mixed,
,
T_limit_vias,
T_mm T_limit_way,
,
T_linear,
T_negative_diagonal T_linear_interpolation,
,
T_load T_net,
T_lock_type,
,
T_net_number T_logical_part,
,
T_logical_part_mapping,
T_net_out T_low,
,
T_match_fromto_delay T_net_pin_changes,
T_match_fromto_length,
,
T_nets T_match_group_delay,
,
T_match_group_length,
T_network T_match_net_delay,
,
T_match_net_length T_network_out,
,
T_max_delay,
T_no T_max_len,
,
T_max_length T_noexpose,
T_max_noise,
,
T_max_restricted_layer_length T_noise_accumulation,
,
T_max_stagger,
T_noise_calculation T_max_stub,
,
T_max_total_delay T_normal,
T_max_total_length,
,
T_max_total_vias T_object_type,
,
T_medium,
T_off T_mhenry,
,
T_mho,
T_off_grid T_microvia,
,
T_mid_driven T_offset,
T_mil,
,
T_min_gap T_on,
,
T_mirror,
T_open T_mirror_first,
,
T_mixed,
T_opposite_side T_mm,
,
T_negative_diagonal T_order,
T_net,
,
T_net_number T_orthogonal,
T_net_out,
,
T_outline T_net_pin_changes,
,
T_nets,
T_overlap T_network,
,
T_network_out,
T_pad T_no,
,
T_noexpose T_pad_pad,
,
T_noise_accumulation,
T_padstack T_noise_calculation,
,
T_normal,
T_pair T_object_type,
,
T_off T_parallel,
T_off_grid,
,
T_offset T_parallel_noise,
T_on,
,
T_parallel_segment T_open,
,
T_opposite_side,
T_parser T_order,
,
T_orthogonal T_part_library,
T_outline,
,
T_overlap T_path,
,
T_pad,
T_pcb T_pad_pad,
,
T_padstack,
T_permit_orient T_pair,
,
T_parallel T_permit_side,
,
T_parallel_noise,
T_physical T_parallel_segment,
,
T_parser T_physical_part_mapping,
T_part_library,
,
T_path T_piggyback,
,
T_pcb,
T_pin T_permit_orient,
,
T_permit_side T_pin_allow,
T_physical,
,
T_physical_part_mapping T_pin_cap_via,
,
T_piggyback,
T_pin_via_cap T_pin,
,
T_pin_allow T_pin_width_taper,
T_pin_cap_via,
,
T_pin_via_cap T_pins,
T_pin_width_taper,
,
T_pintype T_pins,
,
T_pintype,
T_place T_place,
,
T_place_boundary T_place_boundary,
,
T_place_control,
T_place_control T_place_keepout,
,
T_place_rule T_place_keepout,
T_placement,
,
T_plan T_place_rule,
,
T_plane,
T_placement T_pn,
,
T_point T_plan,
,
T_polygon,
T_plane T_polyline_path,
,
T_position T_pn,
,
T_positive_diagonal,
T_point T_power,
,
T_power_dissipation T_polygon,
,
T_power_fanout,
T_polyline_path T_prefix,
,
T_primary T_position,
T_priority,
,
T_property T_positive_diagonal,
,
T_protect,
T_power T_qarc,
,
T_quarter T_power_dissipation,
T_radius,
,
T_ratio T_power_fanout,
,
T_ratio_tolerance,
T_prefix T_rect,
,
T_reduced T_primary,
T_region,
,
T_priority T_region_class,
,
T_region_class_class,
T_property T_region_net,
,
T_relative_delay T_protect,
,
T_relative_group_delay,
T_qarc T_relative_group_length,
,
T_relative_length T_quarter,
,
T_reorder,
T_radius T_reroute_order_viols,
,
T_resistance_resolution T_ratio,
T_resistor,
,
T_resolution T_ratio_tolerance,
,
T_restricted_layer_length_factor,
T_rect T_room,
,
T_rotate T_reduced,
T_rotate_first,
,
T_round T_region,
,
T_roundoff_rotation,
T_region_class T_route,
,
T_route_to_fanout_only,
T_region_class_class T_routes,
,
T_routes_include T_region_net,
T_rule,
,
T_same_net_checking T_relative_delay,
,
T_sample_window,
T_relative_group_delay T_saturation_length,
,
T_sec T_relative_group_length,
,
T_secondary,
T_relative_length T_self,
,
T_sequence_number,
T_reorder T_session,
,
T_set_color T_reroute_order_viols,
T_set_pattern,
,
T_shape T_resistance_resolution,
,
T_shield,
T_resistor T_shield_gap,
,
T_shield_loop,
T_resolution T_shield_tie_down_interval,
,
T_shield_width T_restricted_layer_length_factor,
T_side,
,
T_signal T_room,
,
T_site,
T_rotate T_small,
,
T_smd,
T_rotate_first T_snap,
,
T_snap_angle T_round,
T_soft,
,
T_source T_roundoff_rotation,
,
T_space_in_quoted_tokens,
T_route T_spacing,
,
T_spare,
T_route_to_fanout_only T_spiral_via,
,
T_square T_routes,
T_stack_via,
,
T_stack_via_depth T_routes_include,
T_standard,
,
T_rule T_starburst,
,
T_status T_same_net_checking,
T_structure,
,
T_structure_out T_sample_window,
T_subgate,
,
T_saturation_length T_subgates,
,
T_substituted,
T_sec T_such,
,
T_suffix,
T_secondary T_super_placement,
,
T_supply,
T_self T_supply_pin,
,
T_swapping T_sequence_number,
T_switch_window,
,
T_system T_session,
,
T_tandem_noise,
T_set_color T_tandem_segment,
,
T_tandem_shield_overhang,
T_set_pattern T_term_only,
,
T_terminal T_shape,
T_terminator,
,
T_shield T_test,
,
T_shield_gap T_test_points,
,
T_shield_loop T_testpoint,
,
T_shield_tie_down_interval T_threshold,
,
T_shield_width T_time_length_factor,
,
T_side T_time_resolution,
,
T_signal T_tjunction,
,
T_site T_tolerance,
,
T_small,
T_top,
T_smd,
T_topology T_snap,
,
T_total T_snap_angle,
,
T_track_id T_soft,
,
T_turret T_source,
,
T_type T_space_in_quoted_tokens,
,
T_um T_spacing,
,
T_spare T_unassigned,
,
T_spiral_via T_unconnects,
,
T_square T_unit,
,
T_stack_via T_up,
,
T_stack_via_depth,
T_use_array T_standard,
,
T_use_layer T_starburst,
,
T_use_net,
T_status T_use_via,
,
T_value T_structure,
,
T_vertical,
T_structure_out T_via,
,
T_via_array_template T_subgate,
T_via_at_smd,
,
T_subgates T_via_keepout,
,
T_substituted T_via_number,
,
T_such T_via_rotate_first,
,
T_via_site,
T_suffix T_via_size,
,
T_virtual_pin T_super_placement,
,
T_volt,
T_supply T_voltage_resolution,
,
T_was_is T_supply_pin,
T_way,
,
T_weight T_swapping,
,
T_width,
T_switch_window,
T_window,
T_system,
T_wire T_tandem_noise,
,
T_wire_keepout T_tandem_segment,
,
T_wires T_tandem_shield_overhang,
,
T_wires_include T_term_only,
,
T_wiring T_terminal,
,
T_write_resolution T_terminator,
,
T_test T_x,
,
T_test_points T_xy,
,
T_testpoint T_y,
T_threshold,
T_time_length_factor,
T_time_resolution,
T_tjunction,
T_tolerance,
T_top,
T_topology,
T_total,
T_track_id,
T_turret,
T_type,
T_um,
T_unassigned,
T_unconnects,
T_unit,
T_up,
T_use_array,
T_use_layer,
T_use_net };
} // namespace DSN
/**
* Class SPECCTRA_LEXER
* is an automatically generated class using the TokenList2DnsLexer.cmake
* technology, based on keywords provided by file:
* /builddir/build/BUILD/kicad-r12314-5a33f096/pcbnew/specctra_import_export/specctra.keywords
*/
class SPECCTRA_LEXER : public DSNLEXER
{
/// Auto generated lexer keywords table and length:
static const KEYWORD keywords[];
static const unsigned keyword_count;
public:
/**
* Constructor ( const std::string&, const wxString& )
* @param aSExpression is (utf8) text possibly from the clipboard that you want to parse.
* @param aSource is a description of the origin of @a aSExpression, such as a filename.
* If left empty, then _("clipboard") is used.
*/
SPECCTRA_LEXER( const std::string& aSExpression, const wxString& aSource = wxEmptyString ) :
DSNLEXER( keywords, keyword_count, aSExpression, aSource )
{
}
/**
* Constructor ( FILE* )
* takes @a aFile already opened for reading and @a aFilename as parameters.
* The opened file is assumed to be positioned at the beginning of the file
* for purposes of accurate line number reporting in error messages. The
* FILE is closed by this instance when its destructor is called.
* @param aFile is a FILE already opened for reading.
* @param aFilename is the name of the opened file, needed for error reporting.
*/
SPECCTRA_LEXER( FILE* aFile, const wxString& aFilename ) :
DSNLEXER( keywords, keyword_count, aFile, aFilename )
{
}
/**
* Constructor ( LINE_READER* )
* intializes a lexer and prepares to read from @a aLineReader which
* is assumed ready, and may be in use by other DSNLEXERs also. No ownership
* is taken of @a aLineReader. This enables it to be used by other lexers also.
* The transition between grammars in such a case, must happen on a text
* line boundary, not within the same line of text.
*
* @param aLineReader is any subclassed instance of LINE_READER, such as
* STRING_LINE_READER or FILE_LINE_READER. No ownership is taken of aLineReader.
*/
SPECCTRA_LEXER( LINE_READER* aLineReader ) :
DSNLEXER( keywords, keyword_count, aLineReader )
{
}
/**
* Function TokenName
* returns the name of the token in ASCII form.
*/
static const char* TokenName( DSN::T aTok );
/**
* Function NextTok
* returns the next token found in the input file or T_EOF when reaching
* the end of file. Users should wrap this function to return an enum
* to aid in grammar debugging while running under a debugger, but leave
* this lower level function returning an int (so the enum does not collide
* with another usage).
* @return DSN::T - the type of token found next.
* @throw IO_ERROR - only if the LINE_READER throws it.
*/
DSN::T NextTok()
{
return (DSN::T) DSNLEXER::NextTok();
}
/**
* Function NeedSYMBOL
* calls NextTok() and then verifies that the token read in
* satisfies bool IsSymbol().
* If not, an IO_ERROR is thrown.
* @return int - the actual token read in.
* @throw IO_ERROR, if the next token does not satisfy IsSymbol()
*/
DSN::T NeedSYMBOL()
{
return (DSN::T) DSNLEXER::NeedSYMBOL();
}
/**
* Function NeedSYMBOLorNUMBER
* calls NextTok() and then verifies that the token read in
* satisfies bool IsSymbol() or tok==T_NUMBER.
* If not, an IO_ERROR is thrown.
* @return int - the actual token read in.
* @throw IO_ERROR, if the next token does not satisfy the above test
*/
DSN::T NeedSYMBOLorNUMBER()
{
return (DSN::T) DSNLEXER::NeedSYMBOLorNUMBER();
}
/**
* Function CurTok
* returns whatever NextTok() returned the last time it was called.
*/
DSN::T CurTok()
{
return (DSN::T) DSNLEXER::CurTok();
}
/**
* Function PrevTok
* returns whatever NextTok() returned the 2nd to last time it was called.
*/
DSN::T PrevTok()
{
return (DSN::T) DSNLEXER::PrevTok();
}
};
// example usage
/**
* Class _PARSER
* holds data and functions pertinent to parsing a S-expression file .
*
class SPECCTRA_PARSER : public SPECCTRA_LEXER
{
};
*/
#endif // SPECCTRA_LEXER_H_
,
T_use_via,
T_value,
T_vertical,
T_via,
T_via_array_template,
T_via_at_smd,
T_via_keepout,
T_via_number,
T_via_rotate_first,
T_via_site,
T_via_size,
T_virtual_pin,
T_volt,
T_voltage_resolution,
T_was_is,
T_way,
T_weight,
T_width,
T_window,
T_wire,
T_wire_keepout,
T_wires,
T_wires_include,
T_wiring,
T_write_resolution,
T_x,
T_xy,
T_y
};
} // namespace DSN
/**
* Class SPECCTRA_LEXER
* is an automatically generated class using the TokenList2DnsLexer.cmake
* technology, based on keywords provided by file:
* /builddir/build/BUILD/kicad-r12314-5a33f096/pcbnew/specctra_import_export/specctra.keywords
*/
class SPECCTRA_LEXER : public DSNLEXER
{
/// Auto generated lexer keywords table and length:
static const KEYWORD keywords[];
static const unsigned keyword_count;
public:
/**
* Constructor ( const std::string&, const wxString& )
* @param aSExpression is (utf8) text possibly from the clipboard that you want to parse.
* @param aSource is a description of the origin of @a aSExpression, such as a filename.
* If left empty, then _("clipboard") is used.
*/
SPECCTRA_LEXER( const std::string& aSExpression, const wxString& aSource = wxEmptyString ) :
DSNLEXER( keywords, keyword_count, aSExpression, aSource )
{
}
/**
* Constructor ( FILE* )
* takes @a aFile already opened for reading and @a aFilename as parameters.
* The opened file is assumed to be positioned at the beginning of the file
* for purposes of accurate line number reporting in error messages. The
* FILE is closed by this instance when its destructor is called.
* @param aFile is a FILE already opened for reading.
* @param aFilename is the name of the opened file, needed for error reporting.
*/
SPECCTRA_LEXER( FILE* aFile, const wxString& aFilename ) :
DSNLEXER( keywords, keyword_count, aFile, aFilename )
{
}
/**
* Constructor ( LINE_READER* )
* intializes a lexer and prepares to read from @a aLineReader which
* is assumed ready, and may be in use by other DSNLEXERs also. No ownership
* is taken of @a aLineReader. This enables it to be used by other lexers also.
* The transition between grammars in such a case, must happen on a text
* line boundary, not within the same line of text.
*
* @param aLineReader is any subclassed instance of LINE_READER, such as
* STRING_LINE_READER or FILE_LINE_READER. No ownership is taken of aLineReader.
*/
SPECCTRA_LEXER( LINE_READER* aLineReader ) :
DSNLEXER( keywords, keyword_count, aLineReader )
{
}
/**
* Function TokenName
* returns the name of the token in ASCII form.
*/
static const char* TokenName( DSN::T aTok );
/**
* Function NextTok
* returns the next token found in the input file or T_EOF when reaching
* the end of file. Users should wrap this function to return an enum
* to aid in grammar debugging while running under a debugger, but leave
* this lower level function returning an int (so the enum does not collide
* with another usage).
* @return DSN::T - the type of token found next.
* @throw IO_ERROR - only if the LINE_READER throws it.
*/
DSN::T NextTok()
{
return (DSN::T) DSNLEXER::NextTok();
}
/**
* Function NeedSYMBOL
* calls NextTok() and then verifies that the token read in
* satisfies bool IsSymbol().
* If not, an IO_ERROR is thrown.
* @return int - the actual token read in.
* @throw IO_ERROR, if the next token does not satisfy IsSymbol()
*/
DSN::T NeedSYMBOL()
{
return (DSN::T) DSNLEXER::NeedSYMBOL();
}
/**
* Function NeedSYMBOLorNUMBER
* calls NextTok() and then verifies that the token read in
* satisfies bool IsSymbol() or tok==T_NUMBER.
* If not, an IO_ERROR is thrown.
* @return int - the actual token read in.
* @throw IO_ERROR, if the next token does not satisfy the above test
*/
DSN::T NeedSYMBOLorNUMBER()
{
return (DSN::T) DSNLEXER::NeedSYMBOLorNUMBER();
}
/**
* Function CurTok
* returns whatever NextTok() returned the last time it was called.
*/
DSN::T CurTok()
{
return (DSN::T) DSNLEXER::CurTok();
}
/**
* Function PrevTok
* returns whatever NextTok() returned the 2nd to last time it was called.
*/
DSN::T PrevTok()
{
return (DSN::T) DSNLEXER::PrevTok();
}
};
// example usage
/**
* Class _PARSER
* holds data and functions pertinent to parsing a S-expression file .
*
class SPECCTRA_PARSER : public SPECCTRA_LEXER
{
};
*/
#endif // SPECCTRA_LEXER_H_
References