Changeset View
Changeset View
Standalone View
Standalone View
src/parser/PhutilTypeSpec.php
Show First 20 Lines • Show All 330 Lines • ▼ Show 20 Lines | switch ($rule) { | ||||
return $r; | return $r; | ||||
} else { | } else { | ||||
$obj = new PhutilTypeSpec(); | $obj = new PhutilTypeSpec(); | ||||
$obj->type = 'or'; | $obj->type = 'or'; | ||||
$obj->subtypes[] = $l; | $obj->subtypes[] = $l; | ||||
$obj->subtypes[] = $r; | $obj->subtypes[] = $r; | ||||
return $obj; | return $obj; | ||||
} | } | ||||
break; | |||||
case 'map_type': | case 'map_type': | ||||
$obj = new PhutilTypeSpec(); | $obj = new PhutilTypeSpec(); | ||||
$obj->type = 'map'; | $obj->type = 'map'; | ||||
$obj->subtypes[] = $tokens[2]; | $obj->subtypes[] = $tokens[2]; | ||||
$obj->subtypes[] = $tokens[4]; | $obj->subtypes[] = $tokens[4]; | ||||
return $obj; | return $obj; | ||||
case 'list_type': | case 'list_type': | ||||
$obj = new PhutilTypeSpec(); | $obj = new PhutilTypeSpec(); | ||||
$obj->type = 'list'; | $obj->type = 'list'; | ||||
$obj->subtypes[] = $tokens[2]; | $obj->subtypes[] = $tokens[2]; | ||||
return $obj; | return $obj; | ||||
case 'maybe_optional': | case 'maybe_optional': | ||||
if ($production == 'yes') { | if ($production == 'yes') { | ||||
$tokens[1]->optional = true; | $tokens[1]->optional = true; | ||||
return $tokens[1]; | return $tokens[1]; | ||||
} else { | } else { | ||||
return $tokens[0]; | return $tokens[0]; | ||||
} | } | ||||
break; | |||||
case 'maybe_comment': | case 'maybe_comment': | ||||
if ($production == 'yes') { | if ($production == 'yes') { | ||||
$tokens[0]->comment = $tokens[1]; | $tokens[0]->comment = $tokens[1]; | ||||
} | } | ||||
return $tokens[0]; | return $tokens[0]; | ||||
case 'comment': | case 'comment': | ||||
return $tokens[1]; | return $tokens[1]; | ||||
case 'comment_text': | case 'comment_text': | ||||
▲ Show 20 Lines • Show All 1,559 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0