Spicy
Public Member Functions | List of all members
spicy::detail::codegen::production::LookAhead Class Reference

#include <look-ahead.h>

Inheritance diagram for spicy::detail::codegen::production::LookAhead:
spicy::detail::codegen::ProductionBase spicy::trait::isNonTerminal spicy::trait::isProduction

Public Member Functions

 LookAhead (const std::string &symbol, Production alt1, Production alt2, look_ahead::Default def, const Location &l=location::None)
 
 LookAhead (const std::string &symbol, Production alt1, Production alt2, const Location &l=location::None)
 
const std::pair< Production, Production > & alternatives () const
 
look_ahead::Default default_ () const
 
const std::pair< std::set< Production >, std::set< Production > > & lookAheads () const
 
void setLookAheads (std::pair< std::set< Production >, std::set< Production >> &&lahs)
 
std::vector< std::vector< Production > > rhss () const
 
std::optional< spicy::Typetype () const
 
bool nullable () const
 
bool eodOk () const
 
bool atomic () const
 
bool supportsSynchronize () const
 
std::string render () const
 
- Public Member Functions inherited from spicy::detail::codegen::ProductionBase
 ProductionBase (std::string symbol, Location l=location::None)
 
bool hasSize () const
 
bool maySynchronize () const
 
const Locationlocation () const
 
const std::string & symbol () const
 
void setSymbol (const std::string &s)
 
std::optional< Expression > filter () const
 
void setFilter (const Expression &filter)
 
std::optional< Expression > sink () const
 
void setSink (const Expression &sink)
 
const production::Metameta () const
 
void setMeta (production::Meta m)
 
std::shared_ptr< production::Meta_metaInstance () const
 
void _setMetaInstance (std::shared_ptr< production::Meta > m)
 

Detailed Description

A pair of alternatives between which we can decide with one token of look-ahead.

Member Function Documentation

◆ alternatives()

const std::pair<Production, Production>& spicy::detail::codegen::production::LookAhead::alternatives ( ) const
inline

Returns the two alternatives.

◆ default_()

look_ahead::Default spicy::detail::codegen::production::LookAhead::default_ ( ) const
inline

Returns what's the default alternative.

◆ lookAheads()

const std::pair<std::set<Production>, std::set<Production> >& spicy::detail::codegen::production::LookAhead::lookAheads ( ) const
inline

Returns the look-aheads for the two alternatives. This function will return a valid value only after the instance has been added to a Grammar, as that's when the look-aheads are computed.

◆ setLookAheads()

void spicy::detail::codegen::production::LookAhead::setLookAheads ( std::pair< std::set< Production >, std::set< Production >> &&  lahs)
inline

Sets the look-aheads for the two alternatives. This function is called from a Grammar when the production is added to it.


The documentation for this class was generated from the following files: