mirror of
https://github.com/cwbaker/lalr.git
synced 2026-09-26 16:33:18 +03:00
Inline trivial methods in parser generator
This commit is contained in:
parent
1f572973c3
commit
9ce34162d1
14 changed files with 207 additions and 162 deletions
|
|
@ -16,14 +16,16 @@ class GrammarItem
|
|||
mutable int index_;
|
||||
|
||||
public:
|
||||
GrammarItem();
|
||||
GrammarItem( GrammarProduction* production, int position );
|
||||
int index() const;
|
||||
int production() const;
|
||||
int position() const;
|
||||
bool dot_at_beginning() const;
|
||||
bool operator<( const GrammarItem& item ) const;
|
||||
void set_index( int index ) const;
|
||||
inline GrammarItem();
|
||||
inline GrammarItem( GrammarProduction* production, int position );
|
||||
inline int index() const;
|
||||
inline int production() const;
|
||||
inline int position() const;
|
||||
inline bool dot_at_beginning() const;
|
||||
inline bool operator<( const GrammarItem& item ) const;
|
||||
inline void set_index( int index ) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include "GrammarItem.ipp"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
//
|
||||
// GrammarItem.cpp
|
||||
// GrammarItem.ipp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarItem.hpp"
|
||||
#include "GrammarSymbol.hpp"
|
||||
|
|
@ -10,11 +11,8 @@
|
|||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
using std::find;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::numeric_limits;
|
||||
using namespace lalr;
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
/**
|
||||
// Constructor.
|
||||
|
|
@ -40,11 +38,18 @@ GrammarItem::GrammarItem( GrammarProduction* production, int position )
|
|||
, position_( position )
|
||||
, index_( 0 )
|
||||
{
|
||||
using std::numeric_limits;
|
||||
LALR_ASSERT( production_ >= 0 && production_ < numeric_limits<unsigned short>::max() );
|
||||
LALR_ASSERT( position_ >= 0 && position_ < numeric_limits<unsigned short>::max() );
|
||||
LALR_ASSERT( position_ >= 0 && position_ < production->length() + 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
// Get the index of this item.
|
||||
//
|
||||
// @return
|
||||
// The index of this item.
|
||||
*/
|
||||
int GrammarItem::index() const
|
||||
{
|
||||
return index_;
|
||||
|
|
@ -88,7 +93,7 @@ bool GrammarItem::dot_at_beginning() const
|
|||
// The item to compare this item with.
|
||||
//
|
||||
// @return
|
||||
// True if this items production is less than \e item's or if this item's
|
||||
// True if this item's production is less than \e item's or if this item's
|
||||
// production is the same as \e item's then if this item's next nodes
|
||||
// are lexically less than item's otherwise false.
|
||||
*/
|
||||
|
|
@ -100,7 +105,15 @@ bool GrammarItem::operator<( const GrammarItem& item ) const
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
// Set the index of this item.
|
||||
//
|
||||
// @param index
|
||||
// The index to set this item (assumed >= 0).
|
||||
*/
|
||||
void GrammarItem::set_index( int index ) const
|
||||
{
|
||||
index_ = index;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,18 +15,20 @@ class GrammarLookahead
|
|||
GrammarSymbolSet lookaheads_;
|
||||
|
||||
public:
|
||||
GrammarLookahead( GrammarItem* item, size_t symbols );
|
||||
GrammarLookahead( GrammarLookahead&& item );
|
||||
inline GrammarLookahead( GrammarItem* item, size_t symbols );
|
||||
inline GrammarLookahead( GrammarLookahead&& item );
|
||||
|
||||
GrammarItem* item() const;
|
||||
const std::vector<GrammarLookahead*>& propagate_to() const;
|
||||
const GrammarSymbolSet& lookaheads() const;
|
||||
void set_item( GrammarItem* item );
|
||||
void add_propagate_to( GrammarLookahead* propagate_to );
|
||||
size_t add_lookaheads( const GrammarSymbolSet& lookaheads );
|
||||
inline GrammarItem* item() const;
|
||||
inline const std::vector<GrammarLookahead*>& propagate_to() const;
|
||||
inline const GrammarSymbolSet& lookaheads() const;
|
||||
inline void set_item( GrammarItem* item );
|
||||
inline void add_propagate_to( GrammarLookahead* propagate_to );
|
||||
inline size_t add_lookaheads( const GrammarSymbolSet& lookaheads );
|
||||
|
||||
GrammarLookahead( const GrammarLookahead& item ) = delete;
|
||||
GrammarLookahead& operator=( const GrammarLookahead& item ) = delete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include "GrammarLookahead.ipp"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
//
|
||||
// GrammarLookahead.cpp
|
||||
// GrammarLookahead.ipp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarLookahead.hpp"
|
||||
#include "GrammarItem.hpp"
|
||||
#include "assert.hpp"
|
||||
#include <utility>
|
||||
|
||||
using std::vector;
|
||||
using namespace lalr;
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
GrammarLookahead::GrammarLookahead( GrammarItem* item, size_t symbols )
|
||||
: item_( item )
|
||||
|
|
@ -58,3 +59,5 @@ size_t GrammarLookahead::add_lookaheads( const GrammarSymbolSet& lookaheads )
|
|||
{
|
||||
return lookaheads_.insert( lookaheads );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LALR_GRAMMARPRODUCTION_HPP_INCLUDED
|
||||
#define LALR_GRAMMARPRODUCTION_HPP_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "GrammarSymbol.hpp"
|
||||
#include "GrammarAction.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
|
@ -26,31 +27,31 @@ class GrammarProduction
|
|||
const GrammarSymbol* precedence_symbol_; /// The symbol that defines precedence for this production or null to use the right most terminal.
|
||||
|
||||
public:
|
||||
GrammarProduction( int index, GrammarSymbol* symbol, int line, int column, const GrammarAction* action );
|
||||
inline GrammarProduction( int index, GrammarSymbol* symbol, int line, int column, const GrammarAction* action );
|
||||
|
||||
int index() const;
|
||||
GrammarSymbol* symbol() const;
|
||||
int line() const;
|
||||
int column() const;
|
||||
int count_references_to_symbol( const GrammarSymbol* symbol ) const;
|
||||
bool nullable_after( int position ) const;
|
||||
const GrammarSymbol* find_rightmost_terminal_symbol() const;
|
||||
const GrammarSymbol* symbol_by_position( int position ) const;
|
||||
const std::vector<GrammarSymbol*>& symbols() const;
|
||||
int length() const;
|
||||
const GrammarAction* action() const;
|
||||
int action_index() const;
|
||||
const GrammarSymbol* precedence_symbol() const;
|
||||
int precedence() const;
|
||||
inline int index() const;
|
||||
inline GrammarSymbol* symbol() const;
|
||||
inline int line() const;
|
||||
inline int column() const;
|
||||
inline int count_references_to_symbol( const GrammarSymbol* symbol ) const;
|
||||
inline bool nullable_after( int position ) const;
|
||||
inline const GrammarSymbol* find_rightmost_terminal_symbol() const;
|
||||
inline const GrammarSymbol* symbol_by_position( int position ) const;
|
||||
inline const std::vector<GrammarSymbol*>& symbols() const;
|
||||
inline int length() const;
|
||||
inline const GrammarAction* action() const;
|
||||
inline int action_index() const;
|
||||
inline const GrammarSymbol* precedence_symbol() const;
|
||||
inline int precedence() const;
|
||||
|
||||
void append_symbol( GrammarSymbol* symbol );
|
||||
void set_action( const GrammarAction* action );
|
||||
void set_precedence_symbol( const GrammarSymbol* symbol );
|
||||
void replace_references_to_symbol( GrammarSymbol* to_symbol, GrammarSymbol* with_symbol );
|
||||
inline void append_symbol( GrammarSymbol* symbol );
|
||||
inline void set_action( const GrammarAction* action );
|
||||
inline void set_precedence_symbol( const GrammarSymbol* symbol );
|
||||
inline void replace_references_to_symbol( GrammarSymbol* to_symbol, GrammarSymbol* with_symbol );
|
||||
|
||||
static const int INVALID_INDEX = -1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "GrammarProduction.ipp"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
//
|
||||
// GrammarProduction.cpp
|
||||
// GrammarProduction.ipp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarProduction.hpp"
|
||||
#include "GrammarSymbol.hpp"
|
||||
#include "GrammarAction.hpp"
|
||||
#include "assert.hpp"
|
||||
|
||||
using std::vector;
|
||||
using namespace lalr;
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
/*
|
||||
// Constructor.
|
||||
|
|
@ -95,6 +96,7 @@ int GrammarProduction::column() const
|
|||
*/
|
||||
int GrammarProduction::count_references_to_symbol( const GrammarSymbol* symbol ) const
|
||||
{
|
||||
using std::vector;
|
||||
int references = 0;
|
||||
for ( vector<GrammarSymbol*>::const_iterator i = symbols_.begin(); i != symbols_.end(); ++i )
|
||||
{
|
||||
|
|
@ -116,6 +118,7 @@ int GrammarProduction::count_references_to_symbol( const GrammarSymbol* symbol )
|
|||
*/
|
||||
bool GrammarProduction::nullable_after( int position ) const
|
||||
{
|
||||
using std::vector;
|
||||
LALR_ASSERT( position >= 0 && position <= length() );
|
||||
if ( position >= 0 && position < length() )
|
||||
{
|
||||
|
|
@ -146,6 +149,7 @@ bool GrammarProduction::nullable_after( int position ) const
|
|||
*/
|
||||
const GrammarSymbol* GrammarProduction::find_rightmost_terminal_symbol() const
|
||||
{
|
||||
using std::vector;
|
||||
vector<GrammarSymbol*>::const_reverse_iterator i = symbols_.rbegin();
|
||||
while ( i != symbols_.rend() && (*i)->symbol_type() != SYMBOL_TERMINAL )
|
||||
{
|
||||
|
|
@ -281,6 +285,7 @@ void GrammarProduction::replace_references_to_symbol( GrammarSymbol* to_symbol,
|
|||
precedence_symbol_ = with_symbol;
|
||||
}
|
||||
|
||||
using std::vector;
|
||||
for ( vector<GrammarSymbol*>::iterator i = symbols_.begin(); i != symbols_.end(); ++i )
|
||||
{
|
||||
if ( *i == to_symbol )
|
||||
|
|
@ -289,3 +294,5 @@ void GrammarProduction::replace_references_to_symbol( GrammarSymbol* to_symbol,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,7 +11,9 @@ class GrammarProduction;
|
|||
class GrammarProductionLess
|
||||
{
|
||||
public:
|
||||
bool operator()( const GrammarProduction* lhs, const GrammarProduction* rhs ) const;
|
||||
inline bool operator()( const GrammarProduction* lhs, const GrammarProduction* rhs ) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include "GrammarProductionLess.ipp"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
// GrammarProductionLess.cpp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarProductionLess.hpp"
|
||||
#include "GrammarProduction.hpp"
|
||||
#include "assert.hpp"
|
||||
|
||||
using namespace lalr;
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
bool GrammarProductionLess::operator()( const GrammarProduction* lhs, const GrammarProduction* rhs ) const
|
||||
{
|
||||
|
|
@ -15,3 +17,5 @@ bool GrammarProductionLess::operator()( const GrammarProduction* lhs, const Gram
|
|||
LALR_ASSERT( rhs->index() >= 0 );
|
||||
return lhs->index() < rhs->index();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef LALR_GRAMMARSTATELESS_HPP_INCLUDED
|
||||
#define LALR_GRAMMARSTATELESS_HPP_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "GrammarState.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace lalr
|
||||
|
|
@ -14,9 +14,9 @@ class GrammarState;
|
|||
class GrammarStateLess
|
||||
{
|
||||
public:
|
||||
bool operator()( const std::shared_ptr<GrammarState>& lhs, const std::shared_ptr<GrammarState>& rhs ) const;
|
||||
inline bool operator()( const std::shared_ptr<GrammarState>& lhs, const std::shared_ptr<GrammarState>& rhs ) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "GrammarStateLess.ipp"
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
//
|
||||
// GrammarStateLess.hpp
|
||||
// GrammarStateLess.ipp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarStateLess.hpp"
|
||||
#include "GrammarState.hpp"
|
||||
|
||||
using namespace lalr;
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
bool GrammarStateLess::operator()( const std::shared_ptr<GrammarState>& lhs, const std::shared_ptr<GrammarState>& rhs ) const
|
||||
{
|
||||
return *lhs < *rhs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,16 +2,11 @@
|
|||
// GrammarSymbol.cpp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
|
||||
#include "GrammarSymbol.hpp"
|
||||
#include "GrammarProduction.hpp"
|
||||
#include "assert.hpp"
|
||||
#include <memory>
|
||||
|
||||
using std::set;
|
||||
using std::vector;
|
||||
using std::shared_ptr;
|
||||
using std::make_pair;
|
||||
using namespace lalr;
|
||||
|
||||
GrammarSymbol::GrammarSymbol( const std::string& lexeme )
|
||||
|
|
@ -31,81 +26,6 @@ GrammarSymbol::GrammarSymbol( const std::string& lexeme )
|
|||
{
|
||||
}
|
||||
|
||||
const std::string& GrammarSymbol::lexeme() const
|
||||
{
|
||||
return lexeme_;
|
||||
}
|
||||
|
||||
const std::string& GrammarSymbol::identifier() const
|
||||
{
|
||||
return identifier_;
|
||||
}
|
||||
|
||||
SymbolType GrammarSymbol::symbol_type() const
|
||||
{
|
||||
return symbol_type_;
|
||||
}
|
||||
|
||||
LexemeType GrammarSymbol::lexeme_type() const
|
||||
{
|
||||
return lexeme_type_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::literal() const
|
||||
{
|
||||
return lexeme_type_ == LEXEME_LITERAL;
|
||||
}
|
||||
|
||||
Associativity GrammarSymbol::associativity() const
|
||||
{
|
||||
return associativity_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::precedence() const
|
||||
{
|
||||
return precedence_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::line() const
|
||||
{
|
||||
return line_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::nullable() const
|
||||
{
|
||||
return nullable_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::referenced_in_precedence_directive() const
|
||||
{
|
||||
return referenced_in_precedence_directive_;
|
||||
}
|
||||
|
||||
const GrammarSymbolSet& GrammarSymbol::first() const
|
||||
{
|
||||
return first_;
|
||||
}
|
||||
|
||||
const GrammarSymbolSet& GrammarSymbol::follow() const
|
||||
{
|
||||
return follow_;
|
||||
}
|
||||
|
||||
const std::vector<GrammarProduction*>& GrammarSymbol::productions() const
|
||||
{
|
||||
return productions_;
|
||||
}
|
||||
|
||||
const std::multimap<const GrammarSymbol*, GrammarProduction*>& GrammarSymbol::reachable_productions_by_first_symbol() const
|
||||
{
|
||||
return reachable_productions_by_first_symbol_;
|
||||
}
|
||||
|
||||
std::multimap<const GrammarSymbol*, GrammarProduction*>::const_iterator GrammarSymbol::find_reachable_productions( const GrammarSymbol& first_symbol ) const
|
||||
{
|
||||
return reachable_productions_by_first_symbol_.find( &first_symbol );
|
||||
|
|
@ -218,6 +138,7 @@ void GrammarSymbol::append_reachable_production( GrammarProduction* production )
|
|||
LALR_ASSERT( production );
|
||||
const GrammarSymbol* first_symbol = production->symbol_by_position( 0 );
|
||||
LALR_ASSERT( first_symbol );
|
||||
using std::make_pair;
|
||||
reachable_productions_by_first_symbol_.insert( make_pair(first_symbol, production) );
|
||||
}
|
||||
|
||||
|
|
@ -502,6 +423,7 @@ int GrammarSymbol::calculate_first()
|
|||
int added = 0;
|
||||
if ( symbol_type_ == SYMBOL_NON_TERMINAL )
|
||||
{
|
||||
using std::vector;
|
||||
for ( vector<GrammarProduction*>::const_iterator i = productions_.begin(); i != productions_.end(); ++i )
|
||||
{
|
||||
const GrammarProduction* production = *i;
|
||||
|
|
@ -545,6 +467,7 @@ int GrammarSymbol::calculate_first()
|
|||
*/
|
||||
int GrammarSymbol::calculate_follow()
|
||||
{
|
||||
using std::vector;
|
||||
int added = 0;
|
||||
for ( vector<GrammarProduction*>::const_iterator i = productions_.begin(); i != productions_.end(); ++i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#ifndef LALR_GRAMMARSYMBOL_HPP_INCLUDED
|
||||
#define LALR_GRAMMARSYMBOL_HPP_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "GrammarSymbolSet.hpp"
|
||||
#include "SymbolType.hpp"
|
||||
|
|
@ -35,21 +34,21 @@ class GrammarSymbol
|
|||
public:
|
||||
GrammarSymbol( const std::string& lexeme );
|
||||
|
||||
const std::string& lexeme() const;
|
||||
const std::string& identifier() const;
|
||||
SymbolType symbol_type() const;
|
||||
LexemeType lexeme_type() const;
|
||||
bool literal() const;
|
||||
Associativity associativity() const;
|
||||
int precedence() const;
|
||||
int line() const;
|
||||
int index() const;
|
||||
bool nullable() const;
|
||||
bool referenced_in_precedence_directive() const;
|
||||
const GrammarSymbolSet& first() const;
|
||||
const GrammarSymbolSet& follow() const;
|
||||
const std::vector<GrammarProduction*>& productions() const;
|
||||
const std::multimap<const GrammarSymbol*, GrammarProduction*>& reachable_productions_by_first_symbol() const;
|
||||
inline const std::string& lexeme() const;
|
||||
inline const std::string& identifier() const;
|
||||
inline SymbolType symbol_type() const;
|
||||
inline LexemeType lexeme_type() const;
|
||||
inline bool literal() const;
|
||||
inline Associativity associativity() const;
|
||||
inline int precedence() const;
|
||||
inline int line() const;
|
||||
inline int index() const;
|
||||
inline bool nullable() const;
|
||||
inline bool referenced_in_precedence_directive() const;
|
||||
inline const GrammarSymbolSet& first() const;
|
||||
inline const GrammarSymbolSet& follow() const;
|
||||
inline const std::vector<GrammarProduction*>& productions() const;
|
||||
inline const std::multimap<const GrammarSymbol*, GrammarProduction*>& reachable_productions_by_first_symbol() const;
|
||||
std::multimap<const GrammarSymbol*, GrammarProduction*>::const_iterator find_reachable_productions( const GrammarSymbol& first_symbol ) const;
|
||||
GrammarSymbol* implicit_terminal() const;
|
||||
bool matches( const std::string& lexeme, SymbolType symbol_type ) const;
|
||||
|
|
@ -78,4 +77,4 @@ public:
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "GrammarSymbol.ipp"
|
||||
|
|
|
|||
90
src/lalr/GrammarSymbol.ipp
Normal file
90
src/lalr/GrammarSymbol.ipp
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
//
|
||||
// GrammarSymbol.ipp
|
||||
// Copyright (c) Charles Baker. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "GrammarSymbol.hpp"
|
||||
#include "GrammarProduction.hpp"
|
||||
#include "assert.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace lalr
|
||||
{
|
||||
|
||||
const std::string& GrammarSymbol::lexeme() const
|
||||
{
|
||||
return lexeme_;
|
||||
}
|
||||
|
||||
const std::string& GrammarSymbol::identifier() const
|
||||
{
|
||||
return identifier_;
|
||||
}
|
||||
|
||||
SymbolType GrammarSymbol::symbol_type() const
|
||||
{
|
||||
return symbol_type_;
|
||||
}
|
||||
|
||||
LexemeType GrammarSymbol::lexeme_type() const
|
||||
{
|
||||
return lexeme_type_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::literal() const
|
||||
{
|
||||
return lexeme_type_ == LEXEME_LITERAL;
|
||||
}
|
||||
|
||||
Associativity GrammarSymbol::associativity() const
|
||||
{
|
||||
return associativity_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::precedence() const
|
||||
{
|
||||
return precedence_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::line() const
|
||||
{
|
||||
return line_;
|
||||
}
|
||||
|
||||
int GrammarSymbol::index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::nullable() const
|
||||
{
|
||||
return nullable_;
|
||||
}
|
||||
|
||||
bool GrammarSymbol::referenced_in_precedence_directive() const
|
||||
{
|
||||
return referenced_in_precedence_directive_;
|
||||
}
|
||||
|
||||
const GrammarSymbolSet& GrammarSymbol::first() const
|
||||
{
|
||||
return first_;
|
||||
}
|
||||
|
||||
const GrammarSymbolSet& GrammarSymbol::follow() const
|
||||
{
|
||||
return follow_;
|
||||
}
|
||||
|
||||
const std::vector<GrammarProduction*>& GrammarSymbol::productions() const
|
||||
{
|
||||
return productions_;
|
||||
}
|
||||
|
||||
const std::multimap<const GrammarSymbol*, GrammarProduction*>& GrammarSymbol::reachable_productions_by_first_symbol() const
|
||||
{
|
||||
return reachable_productions_by_first_symbol_;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,13 +16,8 @@ for _, cc in toolsets('^cc.*') do
|
|||
'GrammarAction.cpp',
|
||||
'GrammarCompiler.cpp',
|
||||
'GrammarGenerator.cpp',
|
||||
'GrammarItem.cpp',
|
||||
'GrammarLookahead.cpp',
|
||||
'GrammarParser.cpp',
|
||||
'GrammarProduction.cpp',
|
||||
'GrammarProductionLess.cpp',
|
||||
'GrammarState.cpp',
|
||||
'GrammarStateLess.cpp',
|
||||
'GrammarSymbol.cpp',
|
||||
'GrammarSymbolSet.cpp',
|
||||
'GrammarTransition.cpp'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue