com.google.debugging.sourcemap
Class SourceMapConsumerV3

java.lang.Object
  extended by com.google.debugging.sourcemap.SourceMapConsumerV3
All Implemented Interfaces:
SourceMapConsumer, SourceMapping, SourceMappingReversable

public class SourceMapConsumerV3
extends Object
implements SourceMapConsumer, SourceMappingReversable

Class for parsing version 3 of the SourceMap format, as produced by the Closure Compiler, etc. http://code.google.com/p/closure-compiler/wiki/SourceMaps


Nested Class Summary
static interface SourceMapConsumerV3.EntryVisitor
           
 
Constructor Summary
SourceMapConsumerV3()
           
 
Method Summary
 Mapping.OriginalMapping getMappingForLine(int lineNumber, int column)
          Returns the original mapping for the line number and column position found in the source map.
 Collection<String> getOriginalSources()
           
 Collection<Mapping.OriginalMapping> getReverseMapping(String originalFile, int line, int column)
          Given a source file, line, and column, return the reverse mapping (source --> target).
 void parse(org.json.JSONObject sourceMapRoot)
          Parses the given contents containing a source map.
 void parse(org.json.JSONObject sourceMapRoot, SourceMapSupplier sectionSupplier)
          Parses the given contents containing a source map.
 void parse(String contents)
          Parses the given contents containing a source map.
 void parse(String contents, SourceMapSupplier sectionSupplier)
          Parses the given contents containing a source map.
 void visitMappings(SourceMapConsumerV3.EntryVisitor visitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceMapConsumerV3

public SourceMapConsumerV3()
Method Detail

parse

public void parse(String contents)
           throws SourceMapParseException
Parses the given contents containing a source map.

Specified by:
parse in interface SourceMapConsumer
Throws:
SourceMapParseException

parse

public void parse(String contents,
                  SourceMapSupplier sectionSupplier)
           throws SourceMapParseException
Parses the given contents containing a source map.

Throws:
SourceMapParseException

parse

public void parse(org.json.JSONObject sourceMapRoot)
           throws SourceMapParseException
Parses the given contents containing a source map.

Throws:
SourceMapParseException

parse

public void parse(org.json.JSONObject sourceMapRoot,
                  SourceMapSupplier sectionSupplier)
           throws SourceMapParseException
Parses the given contents containing a source map.

Throws:
SourceMapParseException

getMappingForLine

public Mapping.OriginalMapping getMappingForLine(int lineNumber,
                                                 int column)
Description copied from interface: SourceMapping
Returns the original mapping for the line number and column position found in the source map. Returns null if none is found.

Specified by:
getMappingForLine in interface SourceMapping
Parameters:
lineNumber - The line number, with the first being '1'.
column - The column index, with the first being '1'.

getOriginalSources

public Collection<String> getOriginalSources()
Specified by:
getOriginalSources in interface SourceMappingReversable
Returns:
the collection of original sources in this source mapping

getReverseMapping

public Collection<Mapping.OriginalMapping> getReverseMapping(String originalFile,
                                                             int line,
                                                             int column)
Description copied from interface: SourceMappingReversable
Given a source file, line, and column, return the reverse mapping (source --> target). A collection is returned as in some cases (like a function being inlined), one source line may map to more then one target location. An empty collection is returned if there were no matches.

Specified by:
getReverseMapping in interface SourceMappingReversable
Parameters:
originalFile - the source file
line - the source line
column - the source column
Returns:
the reverse mapping (source --> target)

visitMappings

public void visitMappings(SourceMapConsumerV3.EntryVisitor visitor)