Beispiel #1
0
 def _helper(tokens, s):
     res = []
     try:
         p.run(tokens, s)
     except fp.NoParseError as e:
         return fp._Ignored(()), s
     raise fp.NoParseError(u'followed by something we did not want', s)
Beispiel #2
0
 def _helper(tokens, s):
     res = []
     try:
         p.run(tokens, s)
     except fp.NoParseError as e:
         return fp._Ignored(()), s
     raise fp.NoParseError(u'followed by something we did not want', s)
Beispiel #3
0
 def _helper(tokens, s):
     """Iterative implementation preventing the stack overflow."""
     res = []
     start = s.pos
     end = start + len(xs)
     toks = tokens[start:end]
     if _DEBUG:
         vals = [t.value for t in toks]
     else:
         vals = toks
     if vals == xs:
         pos = s.pos + len(xs)
         s2 = fp.State(pos, max(pos, s.max))
         return fp._Ignored(()), s2
     else:
         raise fp.NoParseError(u'Did not match literal ' + xs, s)
Beispiel #4
0
 def _helper(tokens, s):
     """Iterative implementation preventing the stack overflow."""
     res = []
     start = s.pos
     end = start + len(xs)
     toks = tokens[start:end]
     if _DEBUG:
         vals = [t.value for t in toks]
     else:
         vals = toks
     if vals == xs:
         pos = s.pos + len(xs)
         s2 = fp.State(pos, max(pos, s.max))
         return fp._Ignored(()), s2
     else:
         raise fp.NoParseError(u'Did not match literal ' + xs, s)
Beispiel #5
0
 def _helper(tokens, s):
     res = []
     try:
         p.run(tokens, s)
     except fp.NoParseError, e:
         return fp._Ignored(()), s