Skip to content

Commit

Permalink
Improve variable and flow documentation. Simplify condition
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Feb 18, 2016
1 parent 91343d2 commit d5cf665
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Components/JoinKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class JoinKeyword extends Component
* @var Condition[]
*/
public $on;
/**
* Columns in Using clause
*
* @var ArrayObj
*/
public $using;

/**
Expand All @@ -86,7 +91,8 @@ public static function parse(Parser $parser, TokensList $list, array $options =
*
* 1 -----------------------[ expr ]----------------------> 2
*
* 2 ---------------------[ ON|USING ]--------------------> 3/4
* 2 ------------------------[ ON ]-----------------------> 3
* 2 -----------------------[ USING ]---------------------> 4
*
* 3 --------------------[ conditions ]-------------------> 0
*
Expand Down Expand Up @@ -134,8 +140,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$expr->expr = Expression::parse($parser, $list, array('field' => 'table'));
$state = 2;
} elseif ($state === 2) {
if (($token->type === Token::TYPE_KEYWORD) && ($token->value === 'ON' || $token->value === 'USING')) {
$state = $token->value === 'ON' ? 3 : 4;
if ($token->type === Token::TYPE_KEYWORD) {
if ($token->value === 'ON') {
$state = 3;
} elseif ($token->value === 'USING') {
$state = 4;
}
}
} elseif ($state === 3) {
$expr->on = Condition::parse($parser, $list);
Expand Down

0 comments on commit d5cf665

Please sign in to comment.