rply.token

class rply.token.BaseBox

A base class for polymorphic boxes that wrap parser results. Simply use this as a base class for anything you return in a production function of a parser. This is necessary because RPython unlike Python expects functions to always return objects of the same type.

class rply.token.SourcePosition(idx, lineno, colno)

Represents the position of a character in some source string.

Parameters:
  • idx – The index of the character in the source.
  • lineno – The number of the line in which the character occurs.
  • colno – The number of the column in which the character occurs.

The values passed to this object can be retrieved using the identically named attributes.