Doctrine


Doctrine\Common\Annotations\Parser
/Doctrine/Common/Annotations/Parser.php at line 36

Class Parser

Parser

public class Parser

A simple parser for docblock annotations.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision: 3938 $
Author:
Guilherme Blanco
Jonathan Wage
Roman Borschel
Benjamin Eberlei

Constructor Summary

Parser()

Constructs a new AnnotationParser.

Method Summary
mixed

Annotation()

Annotation ::= "@" AnnotationName ["(" [Values] ")"] AnnotationName ::= QualifiedName | SimpleName | AliasedName QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName AliasedName ::= Alias ":" SimpleName NameSpacePart ::= identifier SimpleName ::= identifier Alias ::= identifier

array

Annotations()

Annotations ::= Annotation {[ "*" ]* [Annotation]}

array

ArrayEntry()

ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key "=" PlainValue Key ::= string | integer

array

Arrayx()

Array ::= "{" ArrayEntry {"," ArrayEntry}* "}"

array

FieldAssignment()

FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier

mixed

PlainValue()

PlainValue ::= integer | string | float | boolean | Array | Annotation

mixed

Value()

Value ::= PlainValue | FieldAssignment

array

Values()

Values ::= Array | Value {"," Value}

bool

match(int|string token)

Attempts to match the given token with the current lookahead token.

array

parse(string docBlockString, string context)

Parses the given docblock string for annotations.

void

setAnnotationNamespaceAlias(mixed namespace, mixed alias, $alias )

Sets an alias for an annotation namespace.

void

setDefaultAnnotationNamespace(mixed defaultNamespace, $defaultNamespace )

Sets the default namespace that is assumed for an annotation that does not define a namespace prefix.

Constructor Detail

/Doctrine/Common/Annotations/Parser.php at line 85

Parser

public Parser()

Constructs a new AnnotationParser.


Method Detail

/Doctrine/Common/Annotations/Parser.php at line 224

Annotation

public mixed Annotation()

Annotation ::= "@" AnnotationName ["(" [Values] ")"] AnnotationName ::= QualifiedName | SimpleName | AliasedName QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName AliasedName ::= Alias ":" SimpleName NameSpacePart ::= identifier SimpleName ::= identifier Alias ::= identifier

Returns:
False if it is not a valid Annotation; instance of Annotation subclass otherwise.

/Doctrine/Common/Annotations/Parser.php at line 189

Annotations

public array Annotations()

Annotations ::= Annotation {[ "*" ]* [Annotation]}


/Doctrine/Common/Annotations/Parser.php at line 431

ArrayEntry

public array ArrayEntry()

ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key "=" PlainValue Key ::= string | integer


/Doctrine/Common/Annotations/Parser.php at line 398

Arrayx

public array Arrayx()

Array ::= "{" ArrayEntry {"," ArrayEntry}* "}"


/Doctrine/Common/Annotations/Parser.php at line 384

FieldAssignment

public array FieldAssignment()

FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier


/Doctrine/Common/Annotations/Parser.php at line 342

PlainValue

public mixed PlainValue()

PlainValue ::= integer | string | float | boolean | Array | Annotation


/Doctrine/Common/Annotations/Parser.php at line 326

Value

public mixed Value()

Value ::= PlainValue | FieldAssignment


/Doctrine/Common/Annotations/Parser.php at line 284

Values

public array Values()

Values ::= Array | Value {"," Value}


/Doctrine/Common/Annotations/Parser.php at line 147

match

public bool match(int|string token)

Attempts to match the given token with the current lookahead token. If they match, updates the lookahead token; otherwise raises a syntax error.

Parameters:
token - type or value
Returns:
True if tokens match; false otherwise.

/Doctrine/Common/Annotations/Parser.php at line 119

parse

public array parse(string docBlockString, string context)

Parses the given docblock string for annotations.

Returns:
Array of Annotations. If no annotations are found, an empty array is returned.

/Doctrine/Common/Annotations/Parser.php at line 107

setAnnotationNamespaceAlias

public void setAnnotationNamespaceAlias(mixed namespace, mixed alias, $alias )

Sets an alias for an annotation namespace.


/Doctrine/Common/Annotations/Parser.php at line 96

setDefaultAnnotationNamespace

public void setDefaultAnnotationNamespace(mixed defaultNamespace, $defaultNamespace )

Sets the default namespace that is assumed for an annotation that does not define a namespace prefix.


Doctrine