Skip to content

Instantly share code, notes, and snippets.

@expipiplus1
Created December 15, 2011 16:36
Show Gist options
  • Save expipiplus1/1481763 to your computer and use it in GitHub Desktop.
Save expipiplus1/1481763 to your computer and use it in GitHub Desktop.
std::unique_ptr< TechniqueDeclaration > TechniqueDeclaration::Parse( Lexer::Lexer& lexer )
{
lexer.PushRestorePoint();
std::string name;
if( !lexer.ExpectToken( Lexer::TECHNIQUE ) )
return nullptr;
if( lexer.PeekToken() == Lexer::IDENTIFIER )
{
name = lexer.PeekString();
lexer.Consume();
}
if( !lexer.ExpectToken( Lexer::OPEN_BRACE ) )
return nullptr;
if( !lexer.ExpectToken( Lexer::CLOSE_BRACE ) )
return nullptr;
lexer.PopRestorePoint();
return std::unique_ptr<TechniqueDeclaration>( new TechniqueDeclaration( name ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment