Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
92f22c85
Commit
92f22c85
authored
Aug 08, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] More optimizations on Annotations parser. More docblocks also
parent
ac5fe1f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
49 deletions
+33
-49
Parser.php
lib/Doctrine/Common/Annotations/Parser.php
+33
-49
No files found.
lib/Doctrine/Common/Annotations/Parser.php
View file @
92f22c85
...
...
@@ -263,6 +263,8 @@ class Parser
/**
* Values ::= Value {"," Value}*
*
* @return array
*/
public
function
Values
()
{
...
...
@@ -292,49 +294,12 @@ class Parser
}
return
$values
;
/*if ($this->_lexer->isNextToken(')')) {
// Single value
if (is_array($value)) {
$k = key($value);
$v = $value[$k];
if (is_string($k)) {
// FieldAssignment
$values[$k] = $v;
} else {
$values['value']= $value;
}
} else {
$values['value'] = $value;
}
return $values;
} else {
// FieldAssignment
$k = key($value);
$v = $value[$k];
$values[$k] = $v;
}
while ($this->_lexer->isNextToken(',')) {
$this->match(',');
$value = $this->Value();
if ( ! is_array($value)) {
$this->syntaxError('FieldAssignment', $value);
}
$k = key($value);
$v = $value[$k];
$values[$k] = $v;
}
return $values;*/
}
/**
* Value ::= PlainValue | FieldAssignment
*
* @return mixed
*/
public
function
Value
()
{
...
...
@@ -349,6 +314,8 @@ class Parser
/**
* PlainValue ::= integer | string | float | Array | Annotation
*
* @return mixed
*/
public
function
PlainValue
()
{
...
...
@@ -388,8 +355,10 @@ class Parser
}
/**
* fieldAssignment ::= fieldName "=" plainValue
* fieldName ::= identifier
* FieldAssignment ::= FieldName "=" PlainValue
* FieldName ::= identifier
*
* @return array
*/
public
function
FieldAssignment
()
{
...
...
@@ -402,20 +371,33 @@ class Parser
/**
* Array ::= "{" ArrayEntry {"," ArrayEntry}* "}"
*
* @return array
*/
public
function
Arrayx
()
{
$array
=
$values
=
array
();
$this
->
match
(
'{'
);
$array
=
array
();
$this
->
ArrayEntry
(
$array
);
$values
[]
=
$this
->
ArrayEntry
();
while
(
$this
->
_lexer
->
isNextToken
(
','
))
{
$this
->
match
(
','
);
$
this
->
ArrayEntry
(
$array
);
$
values
[]
=
$this
->
ArrayEntry
(
);
}
$this
->
match
(
'}'
);
foreach
(
$values
as
$value
)
{
$key
=
key
(
$value
);
if
(
is_string
(
$key
))
{
$array
[
$key
]
=
$value
[
$key
];
}
else
{
$array
[]
=
$value
[
$key
];
}
}
return
$array
;
}
...
...
@@ -423,8 +405,10 @@ class Parser
* ArrayEntry ::= Value | KeyValuePair
* KeyValuePair ::= Key "=" Value
* Key ::= string | integer
*
* @return array
*/
public
function
ArrayEntry
(
array
&
$array
)
public
function
ArrayEntry
()
{
$peek
=
$this
->
_lexer
->
glimpse
();
...
...
@@ -438,9 +422,9 @@ class Parser
$key
=
$this
->
_lexer
->
token
[
'value'
];
$this
->
match
(
'='
);
return
$array
[
$key
]
=
$this
->
Value
(
);
return
array
(
$key
=>
$this
->
Value
()
);
}
return
$array
[]
=
$this
->
Value
(
);
return
array
(
$this
->
Value
()
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment