| 1 | # /=====================================================================\ # | ||||||||||
| 2 | # | LaTeXML::Core::Mouth::Binding | # | ||||||||||
| 3 | # | Analog of TeX's Mouth: Tokenizes strings & files | # | ||||||||||
| 4 | # |=====================================================================| # | ||||||||||
| 5 | # | Part of LaTeXML: | # | ||||||||||
| 6 | # | Public domain software, produced as part of work done by the | # | ||||||||||
| 7 | # | United States Government & not subject to copyright in the US. | # | ||||||||||
| 8 | # |---------------------------------------------------------------------| # | ||||||||||
| 9 | # | Bruce Miller <bruce.miller@nist.gov> #_# | # | ||||||||||
| 10 | # | http://dlmf.nist.gov/LaTeXML/ (o o) | # | ||||||||||
| 11 | # \=========================================================ooo==U==ooo=/ # | ||||||||||
| 12 | package LaTeXML::Core::Mouth::Binding; | ||||||||||
| 13 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 2 | ▶ | use LaTeXML::Global; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 2 | ▶ | use LaTeXML::Common::Locator; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 2 | ▶ | use LaTeXML::Common::Error; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | ▶ | use LaTeXML::Util::Pathname; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | # This is a fake mouth, used for processing *.ltxml, *.latexml files | ||||||||||
| 21 | # It exists primarily for the purposes of | ||||||||||
| 22 | # * getting a locator on anything defined in the file | ||||||||||
| 23 | # * serving as a placekeeper in the chain of Mouth's in a Gullet, | ||||||||||
| 24 | # when the binding reads in a proper TeX file. | ||||||||||
| 25 | |||||||||||
| 26 | sub new { | ||||||||||
| 27 | 0 | ▶ | my ($class, $pathname) = @_; | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 28 | 0 | my ($dir, $name, $ext) = pathname_split($pathname); | |||||||||
| 29 | 0 | my $self = bless { source => $pathname, shortsource => "$name.$ext" }, $class; | |||||||||
| 30 | 0 | NoteBegin("Loading $$self{source}"); | |||||||||
| 31 | 0 | return $self; } | |||||||||
| 32 | |||||||||||
| 33 | sub finish { | ||||||||||
| 34 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
finish: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | 0 | NoteEnd("Loading $$self{source}"); | |||||||||
| 36 | 0 | return; } | |||||||||
| 37 | |||||||||||
| 38 | # Evolve to figure out if this gets dynamic location! | ||||||||||
| 39 | sub getLocator { | ||||||||||
| 40 | 0 | ▶ | my ($self, $length) = @_; | ||||||||
|
Subroutine
getLocator: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 41 | 0 | my $path = $$self{source}; | |||||||||
| 42 | 0 | my $frame = 2; | |||||||||
| 43 | 0 | my ($pkg, $file, $line); | |||||||||
| 44 | 0 | ▶ | while (($pkg, $file, $line) = caller($frame++)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | ▶ | last if $file eq $path; } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | ▶ | return LaTeXML::Common::Locator->new($$self{source}, $line ? $line : undef); } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | |||||||||||
| 48 | sub getSource { | ||||||||||
| 49 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
getSource: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 50 | 0 | return $$self{source}; } | |||||||||
| 51 | |||||||||||
| 52 | sub hasMoreInput { | ||||||||||
| 53 | 0 | ▶ | return 0; } | ||||||||
|
Subroutine
hasMoreInput: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 54 | |||||||||||
| 55 | sub readToken { | ||||||||||
| 56 | 0 | ▶ | return; } | ||||||||
|
Subroutine
readToken: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | |||||||||||
| 58 | sub stringify { | ||||||||||
| 59 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 60 | 0 | return "Mouth::Binding[$$self{source}]"; } | |||||||||
| 61 | #====================================================================== | ||||||||||
| 62 | 2 | 1; | |||||||||
| 63 | |||||||||||
| 64 | __END__ | ||||||||||