webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Public Attributes | List of all members
Rule Class Reference

Public Member Functions

 __construct ($start, $end=null)
 
 start ()
 
 end ()
 

Public Attributes

const ALL_WHITESPACE = '/(\s|\r|\n)+/'
 
const C_IDENTIFIER = '/[a-z_][a-z0-9_]*/i'
 
const C_COMMENT = '#//.*?\n|/\*.*?\*/#s'
 
const C_MULTILINECOMMENT = '#/\*.*?\*/#s'
 
const DOUBLEQUOTESTRING = '/"(?:\\\\"|.)*?"/s'
 
const SINGLEQUOTESTRING = "/'(?:\\\\'|.)*?'/s"
 
const C_DOUBLEQUOTESTRING = '/L?"(?:\\\\"|.)*?"/s'
 
const C_SINGLEQUOTESTRING = "/L?'(?:\\\\'|.)*?'/s"
 
const STRING = '/"(?:\\\\"|.)*?"|\'(?:\\\\\'|.)*?\'/s'
 
const C_NUMBER
 

Detailed Description

Represents a nesting rule in the grammar of a language definition.

Individual rules can either be represented by raw strings ("simple" rules) or by a nesting rule. Nesting rules specify where they can start and end. Inside a nesting rule, other rules may be applied (both simple and nesting). For example, a nesting rule may define a string literal. Inside that string, other rules may be applied that recognize escape sequences.

To use a nesting rule, supply how it may start and end, e.g.: $string_rule = array('string' => new Rule('/"/', '/"/')); You also need to specify nested states: $string_states = array('string' => 'escaped'); Now you can add another rule for escaped: $escaped_rule = array('escaped' => '/\(x{1,4}|.)/');

Constructor & Destructor Documentation

◆ __construct()

Rule::__construct (   $start,
  $end = null 
)

Member Function Documentation

◆ end()

Rule::end ( )

Returns the pattern with which this rule may end.

Returns
string

◆ start()

Rule::start ( )

Returns the pattern with which this rule starts.

Returns
string

Member Data Documentation

◆ ALL_WHITESPACE

const Rule::ALL_WHITESPACE = '/(\s|\r|\n)+/'

Common rules.

◆ C_COMMENT

const Rule::C_COMMENT = '#//.*?\n|/\*.*?\*/#s'

◆ C_DOUBLEQUOTESTRING

const Rule::C_DOUBLEQUOTESTRING = '/L?"(?:\\\\"|.)*?"/s'

◆ C_IDENTIFIER

const Rule::C_IDENTIFIER = '/[a-z_][a-z0-9_]*/i'

◆ C_MULTILINECOMMENT

const Rule::C_MULTILINECOMMENT = '#/\*.*?\*/#s'

◆ C_NUMBER

const Rule::C_NUMBER
Initial value:
= '/
(?: # Integer followed by optional fractional part.
(?:
0(?:
x[0-9a-f]+
|
[0-7]*
)
|
\d+
)
(?:\.\d*)?
(?:e[+-]\d+)?
)
|
(?: # Just the fractional part.
(?:\.\d+)
(?:e[+-]?\d+)?
)
/ix'

◆ C_SINGLEQUOTESTRING

const Rule::C_SINGLEQUOTESTRING = "/L?'(?:\\\\'|.)*?'/s"

◆ DOUBLEQUOTESTRING

const Rule::DOUBLEQUOTESTRING = '/"(?:\\\\"|.)*?"/s'

◆ SINGLEQUOTESTRING

const Rule::SINGLEQUOTESTRING = "/'(?:\\\\'|.)*?'/s"

◆ STRING

const Rule::STRING = '/"(?:\\\\"|.)*?"|\'(?:\\\\\'|.)*?\'/s'

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