mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Let's make sure nested commands don't immediately nest commands (aka using a
nested command to determine what the outer nested command is going to call)
This commit is contained in:
parent
b6d28d7560
commit
6b59933673
@ -244,6 +244,7 @@ class Tokenizer:
|
||||
|
||||
def _insideBrackets(self, lexer):
|
||||
ret = []
|
||||
firstToken = True
|
||||
while True:
|
||||
token = lexer.get_token()
|
||||
if not token:
|
||||
@ -255,9 +256,15 @@ class Tokenizer:
|
||||
elif token == self.right:
|
||||
return ret
|
||||
elif token == self.left:
|
||||
if firstToken:
|
||||
s = 'The command called may not be the result ' \
|
||||
'of a nested command.'
|
||||
raise SyntaxError, 'The command called may not be the ' \
|
||||
'result or a nested command.'
|
||||
ret.append(self._insideBrackets(lexer))
|
||||
else:
|
||||
ret.append(self._handleToken(token))
|
||||
firstToken = False
|
||||
return ret
|
||||
|
||||
def tokenize(self, s):
|
||||
|
@ -94,6 +94,7 @@ class TokenizerTestCase(SupyTestCase):
|
||||
def testError(self):
|
||||
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
||||
self.assertRaises(SyntaxError, tokenize, '"foo') #"
|
||||
self.assertRaises(SyntaxError, tokenize, '[[foo]]')
|
||||
|
||||
def testPipe(self):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user