Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
pagespeed::js::JsMinifyingTokenizer Class Reference

#include "js_minify.h"

Public Member Functions

 JsMinifyingTokenizer (const JsTokenizerPatterns *patterns, StringPiece input)
 
 JsMinifyingTokenizer (const JsTokenizerPatterns *patterns, StringPiece input, net_instaweb::source_map::MappingVector *mappings)
 
JsKeywords::Type NextToken (StringPiece *token_out)
 Gets the next token type from the input,.
 
bool has_error () const
 

Detailed Description

This works like JsTokenizer, except that it only emits whitespace and comment tokens that are deemed necessary for the script to work. IE conditional compilation comments are kept; other comments are removed. Whitespace tokens are only emitted if they are necessary to separate other tokens or for semicolon insertion, and any that are emitted will be collapsed to a single whitespace character.

Constructor & Destructor Documentation

pagespeed::js::JsMinifyingTokenizer::JsMinifyingTokenizer ( const JsTokenizerPatterns patterns,
StringPiece  input 
)

Creates a tokenizer that will tokenize the given input string (which must outlive the JsMinifyingTokenizer object).

pagespeed::js::JsMinifyingTokenizer::JsMinifyingTokenizer ( const JsTokenizerPatterns patterns,
StringPiece  input,
net_instaweb::source_map::MappingVector *  mappings 
)

Version that sets source mappings as well. Note: Source Maps are only correct for ASCII text. Line and column numbers will be incorrect if there are multi-byte chars in input.

Todo:
TODO(sligocki): Fix this.

Member Function Documentation

bool pagespeed::js::JsMinifyingTokenizer::has_error ( ) const
inline

True if an error has been encountered. All future calls to NextToken() will return JsKeywords::kEndOfInput with an empty token string.


The documentation for this class was generated from the following file: