| 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 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 5 | ▶ | use LaTeXML::Global; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 5 | ▶ | use LaTeXML::Common::Locator; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 5 | ▶ | use LaTeXML::Common::Error; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 5 | ▶ | 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 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($class, $pathname) = @_; | |||||||||
| 28 | 0 | my ($dir, $name, $ext) = pathname_split($pathname); | |||||||||
| 29 | 0 | my $self = bless { source => $pathname, shortsource => "$name.$ext" }, $class; | |||||||||
| 30 | 0 | ProgressSpinup("Loading $$self{source}"); | |||||||||
| 31 | 0 | return $self; } | |||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | sub finish { | ||||||||
|
Subroutine
finish: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 34 | 0 | my ($self) = @_; | |||||||||
| 35 | 0 | ▶ | return if $$self{finished}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | ProgressSpindown("Loading $$self{source}"); | |||||||||
| 37 | 0 | $$self{finished} = 1; | |||||||||
| 38 | 0 | return; } | |||||||||
| 39 | |||||||||||
| 40 | # Evolve to figure out if this gets dynamic location! | ||||||||||
| 41 | 0 | ▶ | sub getLocator { | ||||||||
|
Subroutine
getLocator: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 42 | 0 | my ($self, $length) = @_; | |||||||||
| 43 | 0 | my $path = $$self{source}; | |||||||||
| 44 | 0 | my $frame = 2; | |||||||||
| 45 | 0 | my ($pkg, $file, $line); | |||||||||
| 46 | 0 | ▶ | while (($pkg, $file, $line) = caller($frame++)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | ▶ | last if $file eq $path; } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | ▶ | return LaTeXML::Common::Locator->new($$self{source}, $line ? $line : undef); } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub getSource { | ||||||||
|
Subroutine
getSource: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 51 | 0 | my ($self) = @_; | |||||||||
| 52 | 0 | return $$self{source}; } | |||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub hasMoreInput { | ||||||||
|
Subroutine
hasMoreInput: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 55 | 0 | return 0; } | |||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub readToken { | ||||||||
|
Subroutine
readToken: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 58 | 0 | return; } | |||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub stringify { | ||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | 0 | my ($self) = @_; | |||||||||
| 62 | 0 | return "Mouth::Binding[$$self{source}]"; } | |||||||||
| 63 | #====================================================================== | ||||||||||
| 64 | 5 | 1; | |||||||||
| 65 | |||||||||||
| 66 | __END__ | ||||||||||