parseEffect(effect, names, placeholders, indexMap): EffectDefinition

Parses an effect string and extracts its type, text, instruction set, parameter type, and parameter value. The function supports three types of effects: “emit”, “revert”, and general expressions.

Parameters

ParameterTypeDescription
effectstringThe effect string to parse.
namesany[]An array of names used for interpreting expressions.
placeholdersPlaceholderStruct[]An array to store placeholder structures extracted during parsing.
indexMaptrackerIndexNameMapping[]A mapping of tracker index names used for interpreting expressions.

Returns

EffectDefinition

An object containing:

  • type: The type of the effect (e.g., EffectType.REVERT, EffectType.EVENT, or EffectType.EXPRESSION).
  • text: The extracted text of the effect.
  • instructionSet: An array of instructions for expression effects.
  • pType: The parameter type (0 for address, 1 for string, 2 for numeric).
  • parameterValue: The extracted parameter value (address, string, or numeric).

Defined in

src/parsing/parsing-utilities.ts:324