@@ 581-609 (lines=29) @@ | ||
578 | * |
|
579 | * @return void |
|
580 | */ |
|
581 | private function processDeferredIdentificationVariables() |
|
582 | { |
|
583 | foreach ($this->deferredIdentificationVariables as $deferredItem) { |
|
584 | $identVariable = $deferredItem['expression']; |
|
585 | ||
586 | // Check if IdentificationVariable exists in queryComponents |
|
587 | if ( ! isset($this->queryComponents[$identVariable])) { |
|
588 | $this->semanticalError( |
|
589 | "'$identVariable' is not defined.", $deferredItem['token'] |
|
590 | ); |
|
591 | } |
|
592 | ||
593 | $qComp = $this->queryComponents[$identVariable]; |
|
594 | ||
595 | // Check if queryComponent points to an AbstractSchemaName or a ResultVariable |
|
596 | if ( ! isset($qComp['metadata'])) { |
|
597 | $this->semanticalError( |
|
598 | "'$identVariable' does not point to a Class.", $deferredItem['token'] |
|
599 | ); |
|
600 | } |
|
601 | ||
602 | // Validate if identification variable nesting level is lower or equal than the current one |
|
603 | if ($qComp['nestingLevel'] > $deferredItem['nestingLevel']) { |
|
604 | $this->semanticalError( |
|
605 | "'$identVariable' is used outside the scope of its declaration.", $deferredItem['token'] |
|
606 | ); |
|
607 | } |
|
608 | } |
|
609 | } |
|
610 | ||
611 | /** |
|
612 | * Validates that the given <tt>NewObjectExpression</tt>. |
|
@@ 703-731 (lines=29) @@ | ||
700 | * |
|
701 | * @return void |
|
702 | */ |
|
703 | private function processDeferredResultVariables() |
|
704 | { |
|
705 | foreach ($this->deferredResultVariables as $deferredItem) { |
|
706 | $resultVariable = $deferredItem['expression']; |
|
707 | ||
708 | // Check if ResultVariable exists in queryComponents |
|
709 | if ( ! isset($this->queryComponents[$resultVariable])) { |
|
710 | $this->semanticalError( |
|
711 | "'$resultVariable' is not defined.", $deferredItem['token'] |
|
712 | ); |
|
713 | } |
|
714 | ||
715 | $qComp = $this->queryComponents[$resultVariable]; |
|
716 | ||
717 | // Check if queryComponent points to an AbstractSchemaName or a ResultVariable |
|
718 | if ( ! isset($qComp['resultVariable'])) { |
|
719 | $this->semanticalError( |
|
720 | "'$resultVariable' does not point to a ResultVariable.", $deferredItem['token'] |
|
721 | ); |
|
722 | } |
|
723 | ||
724 | // Validate if identification variable nesting level is lower or equal than the current one |
|
725 | if ($qComp['nestingLevel'] > $deferredItem['nestingLevel']) { |
|
726 | $this->semanticalError( |
|
727 | "'$resultVariable' is used outside the scope of its declaration.", $deferredItem['token'] |
|
728 | ); |
|
729 | } |
|
730 | } |
|
731 | } |
|
732 | ||
733 | /** |
|
734 | * Validates that the given <tt>PathExpression</tt> is semantically correct for grammar rules: |