com.google.caja.parser.js
Class RegexpLiteral

java.lang.Object
  extended by com.google.caja.parser.AbstractParseTreeNode
      extended by com.google.caja.parser.js.AbstractExpression
          extended by com.google.caja.parser.js.Literal
              extended by com.google.caja.parser.js.RegexpLiteral
All Implemented Interfaces:
Expression, JsonMLCompatible, MutableParseTreeNode, ParseTreeNode, MessagePart, Renderable, java.lang.Cloneable

public final class RegexpLiteral
extends Literal

A regular expression literal like /foo/i.

Author:
mikesamuel@gmail.com

Nested Class Summary
static class RegexpLiteral.RegexpWrapper
           
 
Nested classes/interfaces inherited from interface com.google.caja.parser.MutableParseTreeNode
MutableParseTreeNode.Mutation
 
Nested classes/interfaces inherited from interface com.google.caja.parser.ParseTreeNode
ParseTreeNode.ReflectiveCtor
 
Nested classes/interfaces inherited from interface com.google.caja.reporting.MessagePart
MessagePart.Factory
 
Nested classes/interfaces inherited from interface com.google.caja.parser.js.JsonMLCompatible
JsonMLCompatible.JsonMLBuilder
 
Field Summary
private  RegexpLiteral.RegexpWrapper value
           
 
Fields inherited from interface com.google.caja.parser.ParseTreeNode
TAINTED
 
Constructor Summary
RegexpLiteral(FilePosition pos, RegexpLiteral.RegexpWrapper value)
           
RegexpLiteral(FilePosition pos, RegexpLiteral.RegexpWrapper value, java.util.List<? extends ParseTreeNode> children)
           
RegexpLiteral(FilePosition pos, java.lang.String value)
           
 
Method Summary
static boolean areRegexpModifiersValid(java.lang.String flags)
          Modifiers are the letters allowed to follow a regular expression literal.
 RegexpLiteral.RegexpWrapper getValue()
           
 boolean getValueInBooleanContext()
           
 void render(RenderContext rc)
          Output the textual form to r.getOut().
 com.google.javascript.jscomp.jsonml.JsonML toJsonML()
          Creates a JsonML representation of this AST.
 java.lang.String typeOf()
          null or the result of applying the typeof operator to the result of this expression.
 
Methods inherited from class com.google.caja.parser.js.Literal
childrenChanged, conditionResult, simplifyForSideEffect
 
Methods inherited from class com.google.caja.parser.js.AbstractExpression
fold, isLeftHandSide, makeRenderer
 
Methods inherited from class com.google.caja.parser.AbstractParseTreeNode
acceptPostOrder, acceptPreOrder, appendChild, children, childrenAs, childrenPart, clone, createMutation, equals, format, formatSelf, formatTree, formatTree, getAttributes, getComments, getFilePosition, hashCode, insertBefore, removeChild, replaceChild, setComments, setFilePosition, toString, toStringDeep, toStringDeep
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.caja.parser.MutableParseTreeNode
acceptPostOrder, acceptPreOrder, appendChild, createMutation, insertBefore, removeChild, replaceChild
 
Methods inherited from interface com.google.caja.parser.ParseTreeNode
children, clone, formatTree, getAttributes, getComments, getFilePosition
 
Methods inherited from interface com.google.caja.reporting.MessagePart
format
 

Field Detail

value

private final RegexpLiteral.RegexpWrapper value
Constructor Detail

RegexpLiteral

@ParseTreeNode.ReflectiveCtor
public RegexpLiteral(FilePosition pos,
                                                  RegexpLiteral.RegexpWrapper value,
                                                  java.util.List<? extends ParseTreeNode> children)
Parameters:
children - unused. This ctor is provided for reflection.

RegexpLiteral

public RegexpLiteral(FilePosition pos,
                     RegexpLiteral.RegexpWrapper value)

RegexpLiteral

public RegexpLiteral(FilePosition pos,
                     java.lang.String value)
Method Detail

getValue

public RegexpLiteral.RegexpWrapper getValue()
Specified by:
getValue in interface ParseTreeNode
Specified by:
getValue in class Literal
Returns:
null or a value with subclass specific meaning which encapsulates all parsed state separate from the children.

render

public void render(RenderContext rc)
Description copied from interface: Renderable
Output the textual form to r.getOut().

Specified by:
render in interface Renderable
Overrides:
render in class Literal

getValueInBooleanContext

public boolean getValueInBooleanContext()
Specified by:
getValueInBooleanContext in class Literal

areRegexpModifiersValid

public static boolean areRegexpModifiersValid(java.lang.String flags)
Modifiers are the letters allowed to follow a regular expression literal. Firefox does not recognize the "s" modifier, and no version of javascript deals with the "x" or "e" modifiers, so this regex matches g, i, and m in any order without duplicates.


typeOf

public java.lang.String typeOf()
Description copied from interface: Expression
null or the result of applying the typeof operator to the result of this expression.

Returns:
if the expression yields a result with the same typeof in all environments in which it returns normally, then returns the result of applying the typeof operator to the result. null if the type cannot be determined. This method is conservative, so it may return null where it is possible to prove a bound.

toJsonML

public com.google.javascript.jscomp.jsonml.JsonML toJsonML()
Description copied from interface: JsonMLCompatible
Creates a JsonML representation of this AST.



Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0