ok/jj
1
0
Fork 0
forked from mirrors/jj

revset: move whitespace rule to top

The whitespace rule is a bit special, and it seemed weird that the rule is
defined between literals and operator tokens.
This commit is contained in:
Yuya Nishihara 2024-04-07 19:47:04 +09:00
parent c8f93c50fc
commit 7f1f73b0fa
2 changed files with 3 additions and 3 deletions

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
whitespace = _{ " " | "\t" | "\r" | "\n" | "\x0c" }
identifier_part = @{ (ASCII_ALPHANUMERIC | "_" | "/")+ }
identifier = @{
identifier_part ~ ("." | "-" | "+" ) ~ identifier
@ -27,8 +29,6 @@ string_content_char = @{ !("\"" | "\\") ~ ANY }
string_content = @{ string_content_char+ }
string_literal = ${ "\"" ~ (string_content | string_escape)* ~ "\"" }
whitespace = _{ " " | "\t" | "\r" | "\n" | "\x0c" }
at_op = { "@" }
pattern_kind_op = { ":" }

View file

@ -100,6 +100,7 @@ impl Rule {
fn to_symbol(self) -> Option<&'static str> {
match self {
Rule::EOI => None,
Rule::whitespace => None,
Rule::identifier_part => None,
Rule::identifier => None,
Rule::symbol => None,
@ -107,7 +108,6 @@ impl Rule {
Rule::string_content_char => None,
Rule::string_content => None,
Rule::string_literal => None,
Rule::whitespace => None,
Rule::at_op => Some("@"),
Rule::pattern_kind_op => Some(":"),
Rule::parents_op => Some("-"),