Recognize more openers of secondary clauses in mainClause

This commit is contained in:
dualfroz committed 2026-09-14 16:15:15 +02:00
1 parent 5424b39d8d
commit 6099cb9020
2 files changed
+25 -1

No files matched your search

+10 -1
View File
@@ -1,5 +1,6 @@
// if a clause starts with these, it's not a main clause
const subordinate = `(after|although|as|because|before|if|since|than|that|though|when|whenever|where|whereas|wherever|whether|while|why|unless|until|once)`
// followed by a number, 'since' or 'once' is a preposition or an adverb ('since 2010', 'once upon a time')
const subordinate = `(after|although|as|because|before|if|since|than|that|though|when|whenever|where|whereas|wherever|whether|while|why|unless|until|once) !(#Value|upon|then|now)`
const relative = `(that|which|whichever|who|whoever|whom|whose|whomever)`
// a subordinator or relative pronoun only makes the clause secondary when it
@@ -34,6 +35,7 @@ const mainClause = function (s) {
m = m.ifNo('^so that')
m = m.ifNo('^rather than')
m = m.ifNo('^provided that')
m = m.ifNo('^in case')
if (m.length === 1) {
return m
}
@@ -55,6 +57,13 @@ const mainClause = function (s) {
return m
}
// an infinitive or an inverted condition ('To win ...', 'Had I known ...')
m = m.ifNo('^to #Infinitive')
m = m.ifNo('^#Condition')
if (m.length === 1) {
return m
}
// did we go too far?
if (m.length === 0) {
m = s