openSUSE / suse-doc-style-checker

Style Checker for SUSE Documentation
Other
2 stars 5 forks source link

Optimization: check the number of leftover tokens before starting to check patterns #139

Closed ghost closed 7 years ago

ghost commented 7 years ago

In termcheck, we don't seem to bother to look whether we have enough tokens left in our sentence to apply all patterns that we have.

Before the following for, it would behoove us to check whether we have enough of the sentence left...

                        for patterngrouppattern in patterngrouppatterns:
                            patternposition = wordposition + patterngrouppatternposition
                            if patternposition > (totalwords - 1):
                                trycontextpatterns = False
                                break
                            matchword = None
[...]
ghost commented 7 years ago

No. We already do that @ line 188. Darn it.