209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
// If the identifier is preceded by a TExpr or a Type,
// then this becomes a TDecl or a Decl, respectively.
if( IsTExpr( *leftVal ) )
{
auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );
auto texpr = ValueToIRExpr( *popType() );
pushValue( ToValue( TNamedDecl( move( texpr ), *name ) ).setLocationId( loc ) );
return true;
}
else if( IsType( *leftVal ) )
{
auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );
auto type = ValueToIRExpr( *popType() );
pushValue( ToValue( Decl( move( type ), *name ) ).setLocationId( loc ) );
return true;
}
return parsePrefix( strid, prec );
}
bool Parser::parsePrefix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromIRExpr( t.first );
if( !val )
return false;
if( val->isPoison() )
DiagnosticsManager::GetInstance().setCurrentVerbosityLevel( Verbosity::Silent );
// If the term is a prefix rule value, invoke its parsePrefix() function.
|
|
|
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
// If the identifier is preceded by a TExpr or a Type,
// then this becomes a TDecl or a Decl, respectively.
if( IsTExpr( *leftVal ) )
{
auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );
auto texpr = ValueToEIR( *popType() );
pushValue( ToValue( TNamedDecl( move( texpr ), *name ) ).setLocationId( loc ) );
return true;
}
else if( IsType( *leftVal ) )
{
auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );
auto type = ValueToEIR( *popType() );
pushValue( ToValue( Decl( move( type ), *name ) ).setLocationId( loc ) );
return true;
}
return parsePrefix( strid, prec );
}
bool Parser::parsePrefix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromEIR( t.first );
if( !val )
return false;
if( val->isPoison() )
DiagnosticsManager::GetInstance().setCurrentVerbosityLevel( Verbosity::Silent );
// If the term is a prefix rule value, invoke its parsePrefix() function.
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
m_resolver->consume();
return ( *rule )->parsePrefix( *this, t.second, prec );
}
optional< uint32_t > Parser::getPrecedence( const Term& t, const pvec& vec )
{
auto val = ValueFromIRExpr( t );
if( !val )
return nullopt;
if( val->type() == GetValueType< ptr< OverloadSet > >() )
{
if( !peekLastValue() )
return nullopt;
|
|
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
m_resolver->consume();
return ( *rule )->parsePrefix( *this, t.second, prec );
}
optional< uint32_t > Parser::getPrecedence( const Term& t, const pvec& vec )
{
auto val = ValueFromEIR( t );
if( !val )
return nullopt;
if( val->type() == GetValueType< ptr< OverloadSet > >() )
{
if( !peekLastValue() )
return nullopt;
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
return ( *rule )->getPrecedence( *this );
}
bool Parser::parseInfix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromIRExpr( t.first );
if( !val )
return false;
if( val->isPoison() )
DiagnosticsManager::GetInstance().setCurrentVerbosityLevel( Verbosity::Silent );
if( val->type() == GetValueType< ptr< OverloadSet > >() )
|
|
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
return ( *rule )->getPrecedence( *this );
}
bool Parser::parseInfix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromEIR( t.first );
if( !val )
return false;
if( val->isPoison() )
DiagnosticsManager::GetInstance().setCurrentVerbosityLevel( Verbosity::Silent );
if( val->type() == GetValueType< ptr< OverloadSet > >() )
|