protected function connectRulesToLexer() {
        foreach ($this->rules as $childRule) {
            $childRule->prepare($this->lexer);

            if ($childRule->getName() === $this->startRule->getName()) {
                continue;
            }

            if ($this->startRule->acceptRule($childRule->getName())) {
                $childRule->embedInto($this->startRule->getName(), $this->lexer);
            }

            $childRule->finish($this->lexer);
        }
    }