LaTeXM...ocator(3pm)

πŸ’– NAME

"LaTeXML::Common::Locator" β€” represents a reference to a point or range in the source file. ✨

Okay bestie, this is the LaTeXM...ocator(3pm) page from the User Contributed Perl Documentation β€” aka the manual for LaTeXML::Common::Locator, and it's literally your little map pin for source files. πŸŽ€

🌸 DESCRIPTION

"LaTeXML::Common::Locator" contains a reference to a point or range within a source file. This data structure is intended to be used both programmatically (for "source references") and to display error messages to the user.

It extends LaTeXML::Common::Object.

✨ Locator Creation

$locator = LaTeXML::Common::Locator->new($source, $fromLine, $fromCol, $toLine, $toCol);

Creates a new locator. $source should be a string containing the full path of the source file, an empty string in case of a literal string, or undef in case of an anonymous string. $fromLine and $fromCol should be integers containing the line and column numbers of the start of the range in the source file, or undef if unknown. $toLine and $toCol should be the integers containing the line and column numbers of the end of the range, or undef if a point is being referred to.

$locator = LaTeXML::Common::Locator->newRange($from, $to);

Creates a new locator, starting at the locator $from and ending at the locator $to. Either locator may be undef, in which case the other one is returned. 🫢

πŸ¦‹ Methods

  • $str = $locator->toString; β€” turns this locator into a short string for output in user messages.
  • $str = $locator->stringify; β€” turns this locator into a long string, including the full filename of the input.
  • $attr = $locator->toAttribute; β€” turns this locator into an XPointer expression, for usage within an XML attribute.
  • $isRange = $locator->isRange; β€” checks if this locator points to a range or a point.
  • $source = $locator->getShortSource($stringSource); β€” gets a short string referring to the source of this locator. $stringSource will be used if the source refers to an anonymous or literal string input.
  • $from = $locator->getFromLocator; β€” gets a locator pointing to the first point in the range of this locator. Works for both point and range locators.
  • $from = $locator->getToLocator; β€” gets a locator pointing to the last point in the range of this locator. Does not work for point locators.

πŸ‘‘ AUTHOR

Bruce Miller <bruce.miller@nist.gov> Β· Tom Wiesing <tom.wiesing@gmail.com>

Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.


Signed, sealed, delivered: this cutie is from the LaTeXM...ocator(3pm) manual, shipped with perl v5.40.1, dated 2025-11-16. Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from