@GwtIncompatible(value="com.google.gson") public final class SourceMapConsumerV3 extends java.lang.Object implements SourceMapConsumer, SourceMappingReversable
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SourceMapConsumerV3.DefaultSourceMapSupplier |
private static interface |
SourceMapConsumerV3.Entry
Represents a mapping entry in the source map.
|
static interface |
SourceMapConsumerV3.EntryVisitor |
private class |
SourceMapConsumerV3.MappingBuilder |
private static class |
SourceMapConsumerV3.NamedEntry
This class represents a portion of the generated file, that is mapped
to a section in the original source, and is associated with a name.
|
private static class |
SourceMapConsumerV3.StringCharIterator
A implementation of the Base64VLQ CharIterator used for decoding the
mappings encoded in the JSON string.
|
private static class |
SourceMapConsumerV3.UnmappedEntry
This class represents a portion of the generated file, that is not mapped
to a section in the original source.
|
private static class |
SourceMapConsumerV3.UnnamedEntry
This class represents a portion of the generated file, that is mapped
to a section in the original source.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
extensions |
private int |
lineCount |
private java.util.ArrayList<java.util.ArrayList<SourceMapConsumerV3.Entry>> |
lines |
private java.lang.String[] |
names |
private java.util.Map<java.lang.String,java.util.Map<java.lang.Integer,java.util.Collection<Mapping.OriginalMapping>>> |
reverseSourceMapping
originalFile path ==> original line ==> target mappings
|
private java.lang.String |
sourceRoot |
private java.lang.String[] |
sources |
(package private) static int |
UNMAPPED |
Constructor and Description |
---|
SourceMapConsumerV3() |
Modifier and Type | Method and Description |
---|---|
private int |
compareEntry(java.util.ArrayList<SourceMapConsumerV3.Entry> entries,
int entry,
int target)
Compare an array entry's column value to the target column value.
|
private void |
createReverseMapping()
Reverse the source map; the created mapping will allow us to quickly go
from a source file and line number to a collection of target
OriginalMappings.
|
java.util.Map<java.lang.String,java.lang.Object> |
getExtensions()
Returns all extensions and their values (which can be any json value)
in a Map object.
|
private java.lang.String[] |
getJavaStringArray(com.google.gson.JsonArray array) |
Mapping.OriginalMapping |
getMappingForLine(int lineNumber,
int column)
Returns the original mapping for the line number and column position found
in the source map.
|
private Mapping.OriginalMapping |
getOriginalMappingForEntry(SourceMapConsumerV3.Entry entry)
Creates an "OriginalMapping" object for the given entry object.
|
java.util.Collection<java.lang.String> |
getOriginalSources() |
private Mapping.OriginalMapping |
getPreviousMapping(int lineNumber)
Returns the mapping entry that proceeds the supplied line or null if no
such entry exists.
|
java.util.Collection<Mapping.OriginalMapping> |
getReverseMapping(java.lang.String originalFile,
int line,
int column)
Given a source file, line, and column, return the reverse mapping (source --> target).
|
java.lang.String |
getSourceRoot() |
void |
parse(com.google.gson.JsonObject sourceMapRoot,
SourceMapSupplier sectionSupplier)
Parses the given contents containing a source map.
|
void |
parse(java.lang.String contents)
Parses the given contents containing a source map.
|
void |
parse(java.lang.String contents,
SourceMapSupplier sectionSupplier)
Parses the given contents containing a source map.
|
private void |
parseMetaMap(com.google.gson.JsonObject sourceMapRoot,
SourceMapSupplier sectionSupplier) |
private int |
search(java.util.ArrayList<SourceMapConsumerV3.Entry> entries,
int target,
int start,
int end)
Perform a binary search on the array to find a section that covers
the target column.
|
void |
visitMappings(SourceMapConsumerV3.EntryVisitor visitor) |
static final int UNMAPPED
private java.lang.String[] sources
private java.lang.String[] names
private int lineCount
private java.util.ArrayList<java.util.ArrayList<SourceMapConsumerV3.Entry>> lines
private java.util.Map<java.lang.String,java.util.Map<java.lang.Integer,java.util.Collection<Mapping.OriginalMapping>>> reverseSourceMapping
private java.lang.String sourceRoot
private java.util.Map<java.lang.String,java.lang.Object> extensions
public void parse(java.lang.String contents) throws SourceMapParseException
parse
in interface SourceMapConsumer
SourceMapParseException
public void parse(java.lang.String contents, SourceMapSupplier sectionSupplier) throws SourceMapParseException
SourceMapParseException
public void parse(com.google.gson.JsonObject sourceMapRoot, SourceMapSupplier sectionSupplier) throws SourceMapParseException
SourceMapParseException
private void parseMetaMap(com.google.gson.JsonObject sourceMapRoot, SourceMapSupplier sectionSupplier) throws SourceMapParseException
sourceMapRoot
- SourceMapParseException
public Mapping.OriginalMapping getMappingForLine(int lineNumber, int column)
SourceMapping
getMappingForLine
in interface SourceMapping
lineNumber
- The line number, with the first being '1'.column
- The column index, with the first being '1'.public java.util.Collection<java.lang.String> getOriginalSources()
getOriginalSources
in interface SourceMappingReversable
public java.util.Collection<Mapping.OriginalMapping> getReverseMapping(java.lang.String originalFile, int line, int column)
SourceMappingReversable
getReverseMapping
in interface SourceMappingReversable
originalFile
- the source fileline
- the source linecolumn
- the source columnpublic java.lang.String getSourceRoot()
public java.util.Map<java.lang.String,java.lang.Object> getExtensions()
private java.lang.String[] getJavaStringArray(com.google.gson.JsonArray array) throws com.google.gson.JsonParseException
com.google.gson.JsonParseException
private int search(java.util.ArrayList<SourceMapConsumerV3.Entry> entries, int target, int start, int end)
private int compareEntry(java.util.ArrayList<SourceMapConsumerV3.Entry> entries, int entry, int target)
private Mapping.OriginalMapping getPreviousMapping(int lineNumber)
private Mapping.OriginalMapping getOriginalMappingForEntry(SourceMapConsumerV3.Entry entry)
private void createReverseMapping()
public void visitMappings(SourceMapConsumerV3.EntryVisitor visitor)