ParserError: Expected pragma, import directive or contract/interface/library definition

Hey there fellow devs!

ParserError: Expected pragma, import directive or contract/interface/library definition.
abstract contract Context {
^------^

I've encountered the above error whilst compiling through truffle. Code and compilation worked perfectly on remix but would refuse to verify on BSCScan, so as an alternative I decided to deploy with truffle and so verify through truffle as well but couldn't make it past compilation phase. Any tips / help are greatly appreciated!

It marks an apparent error on line 19

I'd be happy to privately provide full code if needed!

Here is a picture of the erroneous section --

I think there might be something in the first 4 lines, because you have the pragma but its not colored as the pragma on line 29 meaning the compiler is not recognizing it.

But before going to that, for the verification trouble please check our guide on verification:

1 Like

Please, switch places with

// SPDX-License-Identifier: MIT

and

pragma solidity ^0.6.12;

That should do it