Beispiel #1
0
class QBasicTest(unittest.TestCase):
    def setUp(self):
        self.lexer = QBasicLexer()
        self.maxDiff = None

    def testKeywordsWithDollar(self):
        fragment = u'DIM x\nx = RIGHT$("abc", 1)\n'
        expected = [
            (Token.Keyword.Declaration, u'DIM'),
            (Token.Text.Whitespace, u' '),
            (Token.Name.Variable.Global, u'x'),
            (Token.Text, u'\n'),
            (Token.Name.Variable.Global, u'x'),
            (Token.Text.Whitespace, u' '),
            (Token.Operator, u'='),
            (Token.Text.Whitespace, u' '),
            (Token.Keyword.Reserved, u'RIGHT$'),
            (Token.Punctuation, u'('),
            (Token.Literal.String.Double, u'"abc"'),
            (Token.Punctuation, u','),
            (Token.Text.Whitespace, u' '),
            (Token.Literal.Number.Integer.Long, u'1'),
            (Token.Punctuation, u')'),
            (Token.Text, u'\n'),
        ]
        self.assertEqual(expected, list(self.lexer.get_tokens(fragment)))
Beispiel #2
0
 def setUp(self):
     self.lexer = QBasicLexer()
     self.maxDiff = None
Beispiel #3
0
def lexer():
    yield QBasicLexer()