question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash: SyntaxError during parsing of scribble file

See original GitHub issue

I am trying to get scribble to instrument my smart contract, but after fixing a number of issues with my scribble assertions, I get the following error:

(base) 11:24:15 ~/nifty/web/sc/token$ ~/scribble/dist/bin/scribble.js --arm -m files contracts/Thing.sol 
Found 70 annotations in 1 different files.
/home/un/scribble/node_modules/solc-typed-ast/dist/types/typeStrings/typeString_parser.js:631
        return new SyntaxError(SyntaxError.buildMessage(expected1, found), expected1, found, location1);
               ^

SyntaxError: Expected "[", "calldata", "constant", "external", "internal", "memory", "nonpayable", "payable", "pure", "returns", "storage", "view", [\n,\r,
,
], end of input, or whitespace but "p" found.
    at peg$buildStructuredError (/home/un/scribble/node_modules/solc-typed-ast/dist/types/typeStrings/typeString_parser.js:631:16)
    at peg$parse (/home/un/scribble/node_modules/solc-typed-ast/dist/types/typeStrings/typeString_parser.js:5237:15)
    at getNodeType (/home/un/scribble/node_modules/solc-typed-ast/dist/types/typeStrings/typeString_parser.js:56:30)
    at findExternalCalls (/home/un/scribble/dist/instrumenter/instrument.js:67:65)
    at replaceExternalCallSites (/home/un/scribble/dist/instrumenter/instrument.js:437:28)
    at instrumentContract (/home/un/scribble/dist/instrumenter/instrument.js:293:9)
    at instrumentFiles (/home/un/scribble/dist/bin/scribble.js:236:49)
    at /home/un/scribble/dist/bin/scribble.js:695:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  expected: [
    { type: 'other', description: 'whitespace' },
    {
      type: 'class',
      parts: [ '\n', '\r', '
', '
' ],
      inverted: false,
      ignoreCase: false
    },
    { type: 'literal', text: 'external', ignoreCase: false },
    { type: 'literal', text: 'internal', ignoreCase: false },
    { type: 'literal', text: 'pure', ignoreCase: false },
    { type: 'literal', text: 'view', ignoreCase: false },
    { type: 'literal', text: 'payable', ignoreCase: false },
    { type: 'literal', text: 'nonpayable', ignoreCase: false },
    { type: 'literal', text: 'constant', ignoreCase: false },
    { type: 'literal', text: 'returns', ignoreCase: false },
    { type: 'literal', text: '[', ignoreCase: false },
    { type: 'literal', text: 'memory', ignoreCase: false },
    { type: 'literal', text: 'storage', ignoreCase: false },
    { type: 'literal', text: 'calldata', ignoreCase: false },
    { type: 'end' }
  ],
  found: 'p',
  location: {
    source: undefined,
    start: { offset: 32, line: 1, column: 33 },
    end: { offset: 33, line: 1, column: 34 }
  }
}

I don’t know how to cut a minimal example, because there’s no line number into my actual code, and i don’t know what part of the code is appearing as "p" to the syntax parser. Does anyone have any advice or knowledge about this type of error? If I can get some hints, maybe I can cut a minimal example.

Of note:

  • npx hardhat compile works fine
  • This issue repros with both the npm version of scribble, and built-from-source scribble that i downloaded and built a few days ago
  • I had already run scribble --arm a few times, and each time it had complained about an issue with one of my scribble assertions, and I would fix the issue and run again. So it was odd to have this kind of fundamental crash after the main passes appear to have successfully completed. Note that the first line of output is Found 70 annotations in 1 different files.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
cd1m0commented, Oct 13, 2022

Should be fixed in scribble version 0.6.15

1reaction
NeverFearTomorrowcommented, Oct 1, 2022

Great! That seems to have run successfully now. Thanks for the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · ConsenSys/scribble - GitHub
This release brings: Bump solc-typed-ast to 10.3.0; Fix for #195 Crash: SyntaxError during parsing of scribble file. Assets ...
Read more >
SyntaxError: unexpected EOF while parsing - Stack Overflow
The SyntaxError: unexpected EOF while parsing means that the end of your source code was reached before all code blocks were completed.
Read more >
Syntax Parse Examples - Racket Documentation
4 A syntax-parse Crash Course. The syntax-parse form is a tool for unpacking data from a syntax object. It is similar to Racket's...
Read more >
Merlin: A Language Server for OCaml (Experience ... - arXiv
3.4 Partial parsing with error recovery. Recovery is the ability to handle partially incorrect files in Merlin, by asking the parsing and typechecking...
Read more >
SC1070 – Parsing stopped here. Mismatched ... - ShellCheck
ShellCheck found a syntax error at the indicated location. Barring a bug in ShellCheck itself, your shell will also crash with a syntax...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found