Reputation: 11999
petitparser is a parser generator written in dart to be used e.g. in Flutter.
According to this page, petitparser allows to use ref0
to reference the current parse class.
In the section Using Grammar Definitions you read this statement:
To refer to a production defined in the same definition use [ref0] with the function reference as the argument.
According to the docs, you have to define this dependecy to the petitpackage package
dependencies:
petitparser: ^4.0.2
and include this:
import 'package:petitparser/petitparser.dart';
Unfortunately, ref0
and ref1
do not resolve. Why?
In case the package and the sources are out of sync: Does a simple way to replace ref0
by equivalent valid code exist?
Additionally, I didn't find ref0
/ ref1
in the API-documentation.
Upvotes: 3
Views: 107
Reputation: 8947
You are referring to the documentation on GitHub, which is the development version of PetitParser (that is the upcoming version of PetitParser 4.1.0). Please refer to the documentation of the PetitParser version you have installed, i.e https://pub.dev/packages/petitparser/versions/4.0.2.
Regarding your question: Unfortunately 4.0.2 did not document ParserDefinition
in the tutorial. If you read the latest documentation you can replace all references of ref0
, ref1
, ... with ref
. The number suffix was added for 4.1.0 to allow stricter typing.
Upvotes: 1