public function testDisjunctionOfConcatenation()
 {
     $visitor = new slRegularExpressionBonxaiVisitor();
     $this->assertEquals('( ( element a ) | ( ( element b ), ( element c ) ) )', $visitor->visit(new slRegularExpressionChoice(new slRegularExpressionSequence(new slRegularExpressionElement(new slSchemaAutomatonNode('a', 'a'))), new slRegularExpressionSequence(new slRegularExpressionSequence(new slRegularExpressionElement(new slSchemaAutomatonNode('b', 'b'))), new slRegularExpressionSequence(new slRegularExpressionElement(new slSchemaAutomatonNode('c', 'c')))))));
 }
Example #2
0
 /**
  * Visit single type / element
  *
  * Vist a single element and create proper UPSL markup depending on the 
  * elements contents.
  * 
  * @param slSchemaElement $element 
  * @param mixed $ancestorPattern 
  * @return string
  */
 protected function visitType(slSchemaElement $element, $ancestorPattern)
 {
     $typeDef = "\t" . $this->visitAncestorPattern($ancestorPattern) . " = {\n";
     $typeDef .= $this->visitAttributeList($element);
     $regExpVisitor = new slRegularExpressionBonxaiVisitor($this, $root->ownerDocument);
     $typeDef .= "\t\t" . $regExpVisitor->visit($element->type->regularExpression) . "\n";
     return $typeDef . "\t}\n\n";
 }