You are here

function ARC_sparql_parser::parse_ArgList in Taxonomy import/export via XML 5

Same name and namespace in other branches
  1. 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_ArgList()
  2. 6.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_ArgList()
  3. 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_ArgList()
2 calls to ARC_sparql_parser::parse_ArgList()
ARC_sparql_parser::parse_FunctionCall in arc/ARC_sparql_parser.php
ARC_sparql_parser::parse_IRIrefOrFunction in arc/ARC_sparql_parser.php

File

arc/ARC_sparql_parser.php, line 1421

Class

ARC_sparql_parser

Code

function parse_ArgList($val = "") {

  /* () */
  if (preg_match("/^(\\(\\s*\\))(.*)\$/s", $val, $matches)) {
    return array(
      "type" => "arg_list",
      "entries" => array(),
      "unparsed_val" => trim($matches[2]),
    );
  }

  /* list of expressions */
  if (preg_match("/^(\\(.*)\$/s", $val, $matches)) {
    $bracket_data = $this
      ->extract_bracket_data($matches[1]);
    $unparsed_val = trim(substr($val, strlen($bracket_data) + 2));
    $val = $bracket_data;
    $entries = array();
    do {
      $proceed = false;
      $val = substr($val, 0, 1) == "," ? trim(substr($val, 1)) : trim($val);
      if ($val && ($sub_result = $this
        ->parse_Expression($val))) {
        $proceed = true;
        $val = $sub_result["unparsed_val"];
        unset($sub_result["unparsed_val"]);
        $entries[] = $sub_result;
      }
    } while ($proceed);
    return array(
      "type" => "arg_list",
      "entries" => $entries,
      "unparsed_val" => $unparsed_val,
    );
  }
  return false;
}