Modularize parser for "Closes task X as Y"
Summary:
Ref T3886. Ref T3872. Ref T1812. We have several parsers which look for textual references to other objects, like:
Closes Tx.
Depends on Dy.
Reverts Dz.
Currently, these are pretty hard coded, don't get all the edge cases right, and don't generalize well. They're also implemented in the middle of Differential's field code. So I want to:
- Share more code so that, e.g., "Tx, Ty" always works (only some rules support it right now);
- fix bugs in the parser, like T3872;
- make this a modular, extensible process which runs against custom fields, not a builtin part of fields;
- make the internals more flexible to accommodate custom stuff like T1812.
This implements the "Verbs optional-noun Object, Optional Other Objects optional-as-something." grammar in a general way so subclasses can just plug in their keywords. Runtime code doesn't touch this yet.
Test Plan: Ran unit tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3872, T1812, T3886
Differential Revision: https://secure.phabricator.com/D8261
2014-02-18 00:53:47 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialCustomFieldDependsOnParser
|
|
|
|
extends PhabricatorCustomFieldMonogramParser {
|
|
|
|
|
|
|
|
protected function getPrefixes() {
|
|
|
|
return array(
|
|
|
|
'depends on',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getInfixes() {
|
|
|
|
return array(
|
|
|
|
'diff',
|
|
|
|
'diffs',
|
|
|
|
'change',
|
|
|
|
'changes',
|
|
|
|
'rev',
|
|
|
|
'revs',
|
|
|
|
'revision',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getSuffixes() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getMonogramPattern() {
|
2014-02-18 00:58:59 +01:00
|
|
|
return '[Dd]\d+';
|
Modularize parser for "Closes task X as Y"
Summary:
Ref T3886. Ref T3872. Ref T1812. We have several parsers which look for textual references to other objects, like:
Closes Tx.
Depends on Dy.
Reverts Dz.
Currently, these are pretty hard coded, don't get all the edge cases right, and don't generalize well. They're also implemented in the middle of Differential's field code. So I want to:
- Share more code so that, e.g., "Tx, Ty" always works (only some rules support it right now);
- fix bugs in the parser, like T3872;
- make this a modular, extensible process which runs against custom fields, not a builtin part of fields;
- make the internals more flexible to accommodate custom stuff like T1812.
This implements the "Verbs optional-noun Object, Optional Other Objects optional-as-something." grammar in a general way so subclasses can just plug in their keywords. Runtime code doesn't touch this yet.
Test Plan: Ran unit tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3872, T1812, T3886
Differential Revision: https://secure.phabricator.com/D8261
2014-02-18 00:53:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|