From 1eec2f31356e5852e199abe4744d58d122de0364 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Mon, 11 Nov 2024 00:46:20 +0900 Subject: [PATCH] Parse ;& ;| ;;& operators --- yash-syntax/src/parser/lex/op.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/yash-syntax/src/parser/lex/op.rs b/yash-syntax/src/parser/lex/op.rs index 39d89fee..594c98f2 100644 --- a/yash-syntax/src/parser/lex/op.rs +++ b/yash-syntax/src/parser/lex/op.rs @@ -236,9 +236,28 @@ const AND: Trie = Trie(&[Edge { }]); /// Trie of the operators that start with `;`. -const SEMICOLON: Trie = Trie(&[Edge { - key: ';', - value: Some(Operator::SemicolonSemicolon), +const SEMICOLON: Trie = Trie(&[ + Edge { + key: '&', + value: Some(Operator::SemicolonAnd), + next: NONE, + }, + Edge { + key: ';', + value: Some(Operator::SemicolonSemicolon), + next: SEMICOLON_SEMICOLON, + }, + Edge { + key: '|', + value: Some(Operator::SemicolonBar), + next: NONE, + }, +]); + +/// Trie of the operators that start with `;;`. +const SEMICOLON_SEMICOLON: Trie = Trie(&[Edge { + key: '&', + value: Some(Operator::SemicolonSemicolonAnd), next: NONE, }]);