Fix: ADD SWITCHER keyword normalization
- Root cause: Compiler wasn't converting 'ADD SWITCHER' to 'ADD_SWITCHER' - Impact: Users writing 'ADD SWITCHER' (with space) had keyword fail to parse - Files: botserver/src/basic/compiler/mod.rs (added normalization) - Files: botserver/src/basic/mod.rs (fixed case-sensitive 'AS' check, removed redundant pattern) - Testing: Verified syntax patterns match after normalization
This commit is contained in:
parent
6083beb248
commit
30056c29da
2 changed files with 7 additions and 7 deletions
|
|
@ -535,7 +535,8 @@ impl BasicCompiler {
|
|||
.replace("GROUP BY", "GROUP_BY")
|
||||
.replace("ADD SUGGESTION TOOL", "ADD_SUGGESTION_TOOL")
|
||||
.replace("ADD SUGGESTION TEXT", "ADD_SUGGESTION_TEXT")
|
||||
.replace("ADD SUGGESTION", "ADD_SUGGESTION");
|
||||
.replace("ADD SUGGESTION", "ADD_SUGGESTION")
|
||||
.replace("ADD SWITCHER", "ADD_SWITCHER");
|
||||
if normalized.starts_with("SET SCHEDULE") || trimmed.starts_with("SET SCHEDULE") {
|
||||
has_schedule = true;
|
||||
let parts: Vec<&str> = normalized.split('"').collect();
|
||||
|
|
|
|||
|
|
@ -1323,11 +1323,10 @@ pub fn convert_keywords_to_lowercase(script: &str) -> String {
|
|||
// ADD family - single-token keywords to avoid ADD conflicts
|
||||
(r#"ADD_SUGGESTION_TOOL"#, 2, 2, vec!["tool", "text"]),
|
||||
(r#"ADD_SUGGESTION_TEXT"#, 2, 2, vec!["value", "text"]),
|
||||
(r#"ADD_SUGGESTION(?!\\s+TOOL|\\s+TEXT|_)"#, 2, 2, vec!["context", "text"]),
|
||||
(r#"ADD_SWITCHER"#, 2, 2, vec!["switcher", "text"]),
|
||||
(r#"ADD\s+SWITCHER"#, 2, 2, vec!["switcher", "text"]),
|
||||
(r#"ADD_MEMBER"#, 2, 2, vec!["name", "role"]),
|
||||
(r#"ADD\s+MEMBER"#, 2, 2, vec!["name", "role"]),
|
||||
(r#"ADD_SUGGESTION(?!\\s+TOOL|\\s+TEXT|_)"#, 2, 2, vec!["context", "text"]),
|
||||
(r#"ADD_SWITCHER"#, 2, 2, vec!["switcher", "text"]),
|
||||
(r#"ADD_MEMBER"#, 2, 2, vec!["name", "role"]),
|
||||
(r#"ADD\s+MEMBER"#, 2, 2, vec!["name", "role"]),
|
||||
|
||||
// CREATE family
|
||||
(r#"CREATE\s+TASK"#, 1, 1, vec!["task"]),
|
||||
|
|
@ -1358,7 +1357,7 @@ pub fn convert_keywords_to_lowercase(script: &str) -> String {
|
|||
if trimmed_upper.contains("ADD_SUGGESTION_TOOL") ||
|
||||
trimmed_upper.contains("ADD_SUGGESTION_TEXT") ||
|
||||
trimmed_upper.starts_with("ADD_SUGGESTION_") ||
|
||||
(trimmed_upper.starts_with("ADD_SWITCHER") && trimmed.contains(" as ")) ||
|
||||
(trimmed_upper.starts_with("ADD_SWITCHER") && trimmed_upper.contains(" AS ")) ||
|
||||
trimmed_upper.starts_with("ADD_MEMBER") ||
|
||||
(trimmed_upper.starts_with("CLEAR_SWITCHERS") && trimmed.contains('(')) ||
|
||||
(trimmed_upper.starts_with("USE_") && trimmed.contains('(')) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue