89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
return parseInfix( content, precedence );
}, t.content() );
}
bool Parser::parsePrefix( const APSInt& intlit, uint32_t )
{
m_resolver->consume();
pushValue( ToValue( intlit ) );
return true;
}
bool Parser::parsePrefix( const string& strlit, uint32_t )
{
m_resolver->consume();
pushValue( ToValue( strlit ) );
return true;
}
// Standalone (ie not part of a grammar construct that expects them such as a decl), unresolved identifiers
// end up here.
bool Parser::parsePrefix( const StringId& strid, uint32_t )
{
|
|
|
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
return parseInfix( content, precedence );
}, t.content() );
}
bool Parser::parsePrefix( const APSInt& intlit, uint32_t )
{
m_resolver->consume();
pushSimpleValue( ToValue( intlit ) );
return true;
}
bool Parser::parsePrefix( const string& strlit, uint32_t )
{
m_resolver->consume();
pushSimpleValue( ToValue( strlit ) );
return true;
}
// Standalone (ie not part of a grammar construct that expects them such as a decl), unresolved identifiers
// end up here.
bool Parser::parsePrefix( const StringId& strid, uint32_t )
{
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
auto nameTerm = m_resolver->consume();
const auto* name = get_if< StringId >( &nameTerm->content() );
if( IsTExpr( *leftVal ) )
{
auto texpr = ValueToIRExpr( *popValue() );
pushValue( ToValue( TNamedDecl( move( texpr ), *name ) ) );
return true;
}
else if( leftVal->isType() )
{
auto type = ValueToIRExpr( *popValue() );
pushValue( ToValue( Decl( move( type ), *name ) ) );
return true;
}
return parsePrefix( strid, prec );
}
bool Parser::parsePrefix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromIRExpr( t );
if( !val )
return false;
// If the term is a prefix rule value, invoke its parsePrefix() function.
auto rule = FromValue< Rule >( *val );
if( !rule )
{
m_resolver->consume();
pushValue( *val );
return true;
}
if( !( *rule )->isPrefix() )
return false;
m_resolver->consume();
|
|
|
|
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
auto nameTerm = m_resolver->consume();
const auto* name = get_if< StringId >( &nameTerm->content() );
if( IsTExpr( *leftVal ) )
{
auto texpr = ValueToIRExpr( *popValue() );
pushSimpleValue( ToValue( TNamedDecl( move( texpr ), *name ) ) );
return true;
}
else if( leftVal->isType() )
{
auto type = ValueToIRExpr( *popValue() );
pushSimpleValue( ToValue( Decl( move( type ), *name ) ) );
return true;
}
return parsePrefix( strid, prec );
}
bool Parser::parsePrefix( const pvec& vec, uint32_t prec )
{
auto t = *m_resolver->lookAhead();
auto val = ValueFromIRExpr( t );
if( !val )
return false;
// If the term is a prefix rule value, invoke its parsePrefix() function.
auto rule = FromValue< Rule >( *val );
if( !rule )
{
m_resolver->consume();
pushSimpleValue( *val );
return true;
}
if( !( *rule )->isPrefix() )
return false;
m_resolver->consume();
|