Skip to content

Commit 9ffb246

Browse files
Completes adding 'But' keyword for syntax recognition.
1 parent 1cc6b77 commit 9ffb246

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/robotide/controller/macrocontrollers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def create_keyword(self, name, argstr):
232232

233233
def _remove_bdd_prefix(self, name):
234234
matcher = name.lower()
235-
for match in ['given ', 'when ', 'then ', 'and ']:
235+
for match in ['given ', 'when ', 'then ', 'and ', 'but ']:
236236
if matcher.startswith(match):
237237
return name[len(match):]
238238
return name

src/robotide/controller/stepcontrollers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
class StepController(_BaseController):
2626

27-
_GIVEN_WHEN_THEN_MATCHER = re.compile(r'^(given|when|then|and)\s*', re.I)
27+
_GIVEN_WHEN_THEN_MATCHER = re.compile(r'^(given|when|then|and|but)\s*',
28+
re.I)
2829

2930
def __init__(self, parent, step):
3031
self._init(parent, step)

src/robotide/editor/robotframeworklexer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def _tokenize(self, value, index):
275275

276276

277277
class GherkinTokenizer(object):
278-
_gherkin_prefix = re.compile('^(Given|When|Then|And) ', re.IGNORECASE)
278+
_gherkin_prefix = re.compile('^(Given|When|Then|And|But) ', re.IGNORECASE)
279279

280280
def tokenize(self, value, token):
281281
match = self._gherkin_prefix.match(value)
@@ -321,7 +321,7 @@ def tokenize(self, value, index):
321321

322322
def _continues(self, value, index):
323323
return value == '...' and all(self._is_empty(t)
324-
for t in self._prev_values_on_row)
324+
for t in self._prev_values_on_row)
325325

326326
def _is_empty(self, value):
327327
return value in ('', '\\')
@@ -367,8 +367,8 @@ class TestCaseTable(_Table):
367367

368368
@property
369369
def _tokenizer_class(self):
370-
if self._test_template or (self._default_template and
371-
self._test_template is not False):
370+
if self._test_template or (self._default_template
371+
and self._test_template is not False):
372372
return TemplatedKeywordCall
373373
return KeywordCall
374374

@@ -470,7 +470,7 @@ def _split(self, string):
470470
self._state(char, index)
471471
except StopIteration:
472472
return
473-
if index == max_index and not self._scanning_list_variable_index():
473+
if index == max_index and not self._scanning_list_variable_index():
474474
return
475475

476476
def _scanning_list_variable_index(self):

src/robotide/namespace/namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def _add_resource(self, res, ctx, items):
521521

522522
class _Keywords(object):
523523

524-
regexp = re.compile("\s*(given|when|then|and)\s*(.*)", re.IGNORECASE)
524+
regexp = re.compile("\s*(given|when|then|and|but)\s*(.*)", re.IGNORECASE)
525525

526526
def __init__(self, keywords):
527527
self.keywords = robotapi.NormalizedDict(ignore=['_'])

0 commit comments

Comments
 (0)