Class DefaultGssSourceMapGenerator

  • All Implemented Interfaces:
    GssSourceMapGenerator

    public final class DefaultGssSourceMapGenerator
    extends java.lang.Object
    implements GssSourceMapGenerator
    Class to collect and generate source map(v3) for Gss compiler. It is intended to be used by CodePrinter.

    Source Map Revision 3 Proposal: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?usp=sharing

    See Also:
    SourceMapGeneratorV3
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendOutputTo​(java.lang.Appendable out, java.lang.String name)
      Appends the generated source map to out.
      void endSourceMapping​(CssNode node, int endLine, int endCharIndex)
      Finishes the source mapping for the given node at the current position.
      void setSourceRoot​(java.lang.String path)
      Sets the prefix to be added to the beginning of each source path as debuggers expect (prefix + sourceName) to be a URL for loading the source code.
      void startSourceMapping​(CssNode node, int startLine, int startCharIndex)
      Starts the source mapping for the given node at the current position.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultGssSourceMapGenerator

        public DefaultGssSourceMapGenerator​(JobDescription.SourceMapDetailLevel sourceMapDetailLevel)
        Constructor to get source map class to use.
        Parameters:
        sourceMapDetailLevel - used to control the output details of source map
    • Method Detail

      • appendOutputTo

        public void appendOutputTo​(java.lang.Appendable out,
                                   java.lang.String name)
                            throws java.io.IOException
        Appends the generated source map to out.
        Specified by:
        appendOutputTo in interface GssSourceMapGenerator
        Parameters:
        out - an Appendable object to append the output on
        name - filename to be written inside the source map (not the filename where writes to)
        Throws:
        java.io.IOException
        See Also:
        SourceMapGeneratorV3.appendTo(java.lang.Appendable, java.lang.String)
      • startSourceMapping

        public void startSourceMapping​(CssNode node,
                                       int startLine,
                                       int startCharIndex)
        Starts the source mapping for the given node at the current position. This is intended to be called before the node is written to the buffer.
        Specified by:
        startSourceMapping in interface GssSourceMapGenerator
        Parameters:
        node - the CssNode to be processed
        startLine - the first character's line number once it starts writing output
        startCharIndex - the first character's character index once it starts writing output
      • endSourceMapping

        public void endSourceMapping​(CssNode node,
                                     int endLine,
                                     int endCharIndex)
        Finishes the source mapping for the given node at the current position. This is intended to be called immediately after the whole node is written to the buffer.
        Specified by:
        endSourceMapping in interface GssSourceMapGenerator
        Parameters:
        node - the CssNode to be processed
        endLine - the last character's line number when it ends writing output
        endCharIndex - the last character's character index when it ends writing output
      • setSourceRoot

        public void setSourceRoot​(java.lang.String path)
        Sets the prefix to be added to the beginning of each source path as debuggers expect (prefix + sourceName) to be a URL for loading the source code.
        Specified by:
        setSourceRoot in interface GssSourceMapGenerator
        Parameters:
        path - The URL prefix to save in the sourcemap file