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

Classes

class  Iterator
 

Public Types

enum  Type {
  kNull, kTrue, kFalse, kBreak,
  kCase, kCatch, kConst, kDefault,
  kFinally, kFor, kInstanceof, kNew,
  kVar, kContinue, kFunction, kReturn,
  kVoid, kDelete, kIf, kThis,
  kDo, kWhile, kElse, kIn,
  kSwitch, kThrow, kTry, kTypeof,
  kWith, kDebugger, kClass, kEnum,
  kExport, kExtends, kImport, kSuper,
  kImplements, kInterface, kLet, kPackage,
  kPrivate, kProtected, kPublic, kStatic,
  kYield, kNotAKeyword, kComment, kWhitespace,
  kLineSeparator, kSemiInsert, kRegex, kStringLiteral,
  kNumber, kOperator, kIdentifier, kEndOfInput,
  kError
}
 
enum  Flag {
  kNone, kIsValue, kIsReservedNonStrict, kIsReservedStrict,
  kCanPrecedeRegEx
}
 

Static Public Member Functions

static bool IsAKeyword (Type type)
 
static bool CanKeywordPrecedeRegEx (const StringPiece &name)
 
static Type Lookup (const StringPiece &name, Flag *flag)
 

Friends

class net_instaweb::JsLexer
 

Member Enumeration Documentation

Enumerator
kCanPrecedeRegEx 

keywords that can be placed directly before a regex

Enumerator
kNull 

literals

kBreak 

keywords

kClass 

reserved for future use

kImplements 

reserved for future use in strict code

kNotAKeyword 

Sentinel value for gperf.

kComment 

Other types of lexical tokens; returned by lexer, but not gperf.

A block or line comment (not including the linebreak).

kWhitespace 

Whitespace not containing any linebreaks.

kLineSeparator 

Whitespace with linebreaks, but no semicolon insertion.

kSemiInsert 

Whitespace that triggers semicolon insertion.

kRegex 

A regex literal, such as /foo/i or /a+b*/.

kStringLiteral 

A string literal, such as 'foo' or "bar".

kNumber 

A numeric literal, such as 3.5 or 017 or .2e+10.

kOperator 

An operator or symbol, such as && or <<= or (.

kIdentifier 

An identifier (variable name, label, etc).

kEndOfInput 

End of input was reached without errors.

kError 

A syntax error occurred.

Member Function Documentation

static bool pagespeed::JsKeywords::CanKeywordPrecedeRegEx ( const StringPiece &  name)
static

Returns true if name is a javascript keyword that can precede a regular expression. Keywords such as 'return' and 'throw' can precede a regex '/' but keywords such as 'while' cannot.

static Type pagespeed::JsKeywords::Lookup ( const StringPiece &  name,
Flag flag 
)
static

Finds a Keyword based on a keyword string. If not found, returns kNotAKeyword. Otherwise, this always returns a Type for which IsAKeyword is true.

Friends And Related Function Documentation

friend class net_instaweb::JsLexer
friend
Todo:
TODO(jkarlin): Get rid of the net_instaweb namespace once JsLexer is moved into kernel/js.

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